Fix potential NPE when the connection is not created yet when the service is
destroyed
--- a/app/src/main/java/com/beem/project/beem/BeemService.java Fri May 01 01:36:53 2015 +0200
+++ b/app/src/main/java/com/beem/project/beem/BeemService.java Mon Jun 15 14:04:24 2015 +0200
@@ -287,6 +287,7 @@
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Roster.setDefaultSubscriptionMode(SubscriptionMode.manual);
+
mBind = new XmppFacade(this);
Log.d(TAG, "Create BeemService");
}
@@ -302,7 +303,7 @@
mSettings.unregisterOnSharedPreferenceChangeListener(mPreferenceListener);
if (mOnOffReceiverIsRegistered)
unregisterReceiver(mOnOffReceiver);
- if (mConnection.isAuthentificated() && BeemConnectivity.isConnected(this))
+ if (mConnection != null && mConnection.isAuthentificated() && BeemConnectivity.isConnected(this))
mConnection.disconnect();
Log.i(TAG, "Stopping the service");
}