Skip to content

Commit

Permalink
Fix NPE #60
Browse files Browse the repository at this point in the history
  • Loading branch information
mar-v-in committed Feb 12, 2016
1 parent 827c435 commit b26d513
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ private boolean isNetworkLocationEnabled(Context context, ResultCollector collec
private boolean isProvidingLastLocation(Context context, ResultCollector collector) {
LocationManager locationManager = (LocationManager) context.getSystemService(LOCATION_SERVICE);
Location location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
boolean hasKnown = location != null && location.getExtras().containsKey(LOCATION_EXTRA_BACKEND_PROVIDER);
boolean hasKnown = location != null && location.getExtras() != null &&
location.getExtras().containsKey(LOCATION_EXTRA_BACKEND_PROVIDER);
collector.addResult(context.getString(R.string.self_check_name_last_location),
hasKnown ? Positive : Unknown, context.getString(R.string.self_check_resolution_last_location));
return hasKnown;
Expand Down

0 comments on commit b26d513

Please sign in to comment.