packages/apps/Eleven
Révision | 91a8a10d32bbed87e84ac84ec42838d0a034a369 (tree) |
---|---|
l'heure | 2017-10-15 23:01:28 |
Auteur | Gabriele M <moto.falcon.git@gmai...> |
Commiter | Gabriele M |
Eleven: Fix potential NPE when media server crashes
If the service doesn't exist when the media server crashes, Eleven
will crash when creating the TrackErrorInfo object. The SERVER_DIED
message is processed only when the service is not null, so just
ignore the MEDIA_ERROR_SERVER_DIED message if service is null.
BUGBASH-1045
Change-Id: Idaf3e238eefd412ebb85244b48ad7b20bc049ff0
@@ -3442,6 +3442,9 @@ public class MusicPlaybackService extends Service { | ||
3442 | 3442 | switch (what) { |
3443 | 3443 | case MediaPlayer.MEDIA_ERROR_SERVER_DIED: |
3444 | 3444 | final MusicPlaybackService service = mService.get(); |
3445 | + if (service == null) { | |
3446 | + return false; | |
3447 | + } | |
3445 | 3448 | final TrackErrorInfo errorInfo = new TrackErrorInfo(service.getAudioId(), |
3446 | 3449 | service.getTrackName()); |
3447 | 3450 |