Skip to content

Commit

Permalink
fix: fix a probable null pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
itsdebs committed Oct 6, 2023
1 parent 42dee1f commit 9c2639a
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ private static void collectDissentedMetrics(List<RudderServerDestination> destin
List<RudderServerDestination> destinationsCopy = new ArrayList<>(destinations);
destinationsCopy.removeAll(consentedDestinations);
for (RudderServerDestination destination : destinationsCopy) {
reportDiscardedDestinationWithType(destination, ReportManager.LABEL_TYPE_DESTINATION_DISSENTED);
reportDiscardedDestinationWithType(destination.getDestinationDefinition().displayName, ReportManager.LABEL_TYPE_DESTINATION_DISSENTED);
}

}
private static void reportDiscardedDestinationWithType(RudderServerDestination destination, String type) {
private static void reportDiscardedDestinationWithType(String destinationName, String type) {
Map<String,String> labelsMap = new HashMap<>();
labelsMap.put(ReportManager.LABEL_TYPE, type);
labelsMap.put(ReportManager.LABEL_INTEGRATION, destination.getDestinationDefinition().displayName);
labelsMap.put(ReportManager.LABEL_INTEGRATION, destinationName);
ReportManager.incrementDeviceModeDiscardedCounter(1, labelsMap);
}

Expand Down Expand Up @@ -202,7 +202,8 @@ private void initiateFactories(List<RudderServerDestination> destinations) {
integrationOperationsMap.put(key, nativeOp);
handleCallBacks(key, nativeOp);
} else {
reportDiscardedDestinationWithType(destination, ReportManager.LABEL_TYPE_DESTINATION_DISABLED);
reportDiscardedDestinationWithType(destination == null? key : destination.destinationDefinition.displayName
, ReportManager.LABEL_TYPE_DESTINATION_DISABLED);
RudderLogger.logDebug(String.format(Locale.US, "EventRepository: initiateFactories: destination was null or not enabled for %s", key));
}
} else {
Expand Down

0 comments on commit 9c2639a

Please sign in to comment.