From 7f10858e5429102e459b875861f1c32bdd3f4cd7 Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Sun, 4 Apr 2021 12:20:45 +0200 Subject: [PATCH] Fix CMin use from testing --- app/src/main/java/com/prj/app/logic/RiskAnalyser.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/prj/app/logic/RiskAnalyser.java b/app/src/main/java/com/prj/app/logic/RiskAnalyser.java index 1005dd2..d873c58 100644 --- a/app/src/main/java/com/prj/app/logic/RiskAnalyser.java +++ b/app/src/main/java/com/prj/app/logic/RiskAnalyser.java @@ -94,7 +94,7 @@ private void sendMatchingBSSIDsPOST(@NotNull String URL, @NotNull JSONObject jso */ public boolean matchResult(@NotNull JSONArray matchingScans) { List localScans = databaseManager.getScanData(); - if (localScans.size() < 1) { + if (localScans == null || matchingScans == null || localScans.size() < 1) { if (resultTextView != null) { resultTextView.setText("No matches found\n"); } @@ -178,7 +178,7 @@ public List>> getFirstPositiveResult(@NotNull TreeMap(timestamp, timeMap.get(timestamp))); - if (dateStorage.size() >= preferencesManager.getCMin()) { + if (dateStorage.size() >= preferencesManager.getCMin() - 1 ) { return dateStorage; } } else { @@ -188,7 +188,7 @@ public List>> getFirstPositiveResult(@NotNull TreeMap removeNonConcurrentScans(@NotNull List localScans) { if (scanTimeDifference(lastScan, current) <= preferencesManager.getTMax()) { storageList.add(current); } else { - if (storageList.size() >= preferencesManager.getCMin()) { + if (storageList.size() >= preferencesManager.getCMin() -1 ) { validScans.addAll(storageList); } storageList.clear(); @@ -313,7 +313,7 @@ private List removeNonConcurrentScans(@NotNull List localScans) { } for (ArrayList scans : storage.values()) { - if (scans.size() >= preferencesManager.getCMin()) { + if (scans.size() >= preferencesManager.getCMin() - 1) { validScans.addAll(scans); } }