Skip to content

Commit

Permalink
Improve stop service and fix NullPointerException in ClementinePbPars…
Browse files Browse the repository at this point in the history
…er.parseMsg
  • Loading branch information
amuttsch committed Sep 6, 2018
1 parent 0aefe3c commit e0cabf0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Fix crash when opening connect page too fast
- Fix crash when Clementine closes the connection
- Fix crash when opening playlist view
- Fix crash when service was destroyed but the app received a keep alive message
Other:
- Build with API level 28
- Updated translations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ public void onClementineMessageReceived(
}
break;
case SERVICE_DISCONNECTED:
intteruptThread();
App.ClementineConnection = null;
stopSelf();
break;
default:
Expand All @@ -198,7 +196,7 @@ public void onDestroy() {
// Send the request to the thread
App.ClementineConnection.mHandler.sendMessage(msg);
}
intteruptThread();
interruptThread();
App.ClementineConnection = null;
}

Expand All @@ -215,7 +213,7 @@ private void sendDisconnectServiceMessage() {
startService(mServiceIntent);
}

private void intteruptThread() {
private void interruptThread() {
if (mPlayerThread != null) {
mPlayerThread.interrupt();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ private ClementineMessage parseMsg(Message msg) {
parseUpdateTrackPosition(msg.getResponseUpdateTrackPosition());
break;
case KEEP_ALIVE:
App.ClementineConnection.setLastKeepAlive(System.currentTimeMillis());
if (App.ClementineConnection != null) {
App.ClementineConnection.setLastKeepAlive(System.currentTimeMillis());
}
break;
case SET_VOLUME:
App.Clementine.setVolume(msg.getRequestSetVolume().getVolume());
Expand Down

0 comments on commit e0cabf0

Please sign in to comment.