From e0f338ae1c732bc73e6123659653cf3ce6c2415f Mon Sep 17 00:00:00 2001 From: Sarah Lensing Date: Tue, 14 Jun 2016 16:10:00 -0700 Subject: [PATCH] Check listeners not null before iteration --- .../lost/internal/FusedLocationProviderApiImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lost/src/main/java/com/mapzen/android/lost/internal/FusedLocationProviderApiImpl.java b/lost/src/main/java/com/mapzen/android/lost/internal/FusedLocationProviderApiImpl.java index 1d78e16..18a4ea9 100644 --- a/lost/src/main/java/com/mapzen/android/lost/internal/FusedLocationProviderApiImpl.java +++ b/lost/src/main/java/com/mapzen/android/lost/internal/FusedLocationProviderApiImpl.java @@ -111,8 +111,11 @@ public void setMockTrace(File file) { @Override public void reportLocation(LocationEngine engine, Location location) { - for (LocationListener listener : engineListeners.get(engine)) { - listener.onLocationChanged(location); + List listeners = engineListeners.get(engine); + if (listeners != null) { + for (LocationListener listener : listeners) { + listener.onLocationChanged(location); + } } }