aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2016-05-12 15:05:01 +0300
committerDominik Schürmann <dominik@dominikschuermann.de>2016-05-12 15:05:01 +0300
commit74d4421ab08a66428dfd45b64cea8787226150dc (patch)
tree909dbe1c08de691375fc54932b800e22248bf545 /OpenKeychain/src/main/java/org/sufficientlysecure
parentf44bd236224e782d85c9764a4b655ae922356b14 (diff)
downloadopen-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.java5
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) {