# HG changeset patch # User Da Risk # Date 1434369864 -7200 # Node ID b9445d7416607068554892a0ccfdf21ea98c15a0 # Parent 3ad94aed2c263724cbd0f0430edb0b81f4a9c3cb Fix potential NPE when the connection is not created yet when the service is destroyed diff -r 3ad94aed2c26 -r b9445d741660 app/src/main/java/com/beem/project/beem/BeemService.java --- 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"); }