diff --git a/src/main/java/com/botdetector/http/BotDetectorClient.java b/src/main/java/com/botdetector/http/BotDetectorClient.java index 025589a..d5ce6d0 100644 --- a/src/main/java/com/botdetector/http/BotDetectorClient.java +++ b/src/main/java/com/botdetector/http/BotDetectorClient.java @@ -400,15 +400,15 @@ public void onResponse(Call call, Response response) { Prediction p = processResponse(gson, response, Prediction.class); // Sanity check for if the primary label does not appear in the breakdown - if (p != null && p.getPredictionBreakdown() != null && !p.getPredictionBreakdown().isEmpty()) + if (p != null + && p.getConfidence() != null // Some 'debug' labels such as 'Stats_Too_Low' will have null confidence, ignore these! + && p.getPredictionBreakdown() != null + && !p.getPredictionBreakdown().isEmpty() + && p.getPredictionBreakdown().keySet().stream().noneMatch(x -> p.getPredictionLabel().equalsIgnoreCase(x))) { - if (p.getPredictionBreakdown().keySet().stream() - .noneMatch(x -> p.getPredictionLabel().equalsIgnoreCase(x))) - { - p.getPredictionBreakdown().put(p.getPredictionLabel(), p.getConfidence()); - log.warn(String.format("Primary prediction label missing from breakdown! Added missing label. (pl:'%s', id:'%d', lb:'%s', cf:'%.4f')", - p.getPlayerName(), p.getPlayerId(), p.getPredictionLabel(), p.getConfidence())); - } + p.getPredictionBreakdown().put(p.getPredictionLabel(), p.getConfidence()); + log.warn(String.format("Primary prediction label missing from breakdown! Added missing label. (pl:'%s', id:'%d', lb:'%s', cf:'%.4f')", + p.getPlayerName(), p.getPlayerId(), p.getPredictionLabel(), p.getConfidence())); } future.complete(p); }