diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2016-05-12 15:05:01 +0300 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2016-05-12 15:05:01 +0300 |
commit | 74d4421ab08a66428dfd45b64cea8787226150dc (patch) | |
tree | 909dbe1c08de691375fc54932b800e22248bf545 /OpenKeychain/src/main/java/org/sufficientlysecure | |
parent | f44bd236224e782d85c9764a4b655ae922356b14 (diff) | |
download | open-keychain-74d4421ab08a66428dfd45b64cea8787226150dc.tar.gz open-keychain-74d4421ab08a66428dfd45b64cea8787226150dc.tar.bz2 open-keychain-74d4421ab08a66428dfd45b64cea8787226150dc.zip |
Fix NPE in NetworkReceiver
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/receiver/NetworkReceiver.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/receiver/NetworkReceiver.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/receiver/NetworkReceiver.java index 7c103a9a3..c49ab8a34 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/receiver/NetworkReceiver.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/receiver/NetworkReceiver.java @@ -20,8 +20,9 @@ public class NetworkReceiver extends BroadcastReceiver { ConnectivityManager conn = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = conn.getActiveNetworkInfo(); - boolean isTypeWifi = (networkInfo.getType() == ConnectivityManager.TYPE_WIFI); - boolean isConnected = networkInfo.isConnected(); + boolean isTypeWifi = (networkInfo != null) && + (networkInfo.getType() == ConnectivityManager.TYPE_WIFI); + boolean isConnected = (networkInfo != null) && networkInfo.isConnected(); if (isTypeWifi && isConnected) { |