From 44064c25de1805fa5bfd3eae2b689b1a05b2c56e Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Sat, 10 May 2014 12:33:00 +0200 Subject: [PATCH] Fixed crash when route is added. --- .../controldlna/mediarouter/MediaRouterPlayService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/nutomic/controldlna/mediarouter/MediaRouterPlayService.java b/src/main/java/com/github/nutomic/controldlna/mediarouter/MediaRouterPlayService.java index 307f688..8b8c510 100644 --- a/src/main/java/com/github/nutomic/controldlna/mediarouter/MediaRouterPlayService.java +++ b/src/main/java/com/github/nutomic/controldlna/mediarouter/MediaRouterPlayService.java @@ -133,8 +133,10 @@ public class MediaRouterPlayService extends Service { public void onRouteAdded(MediaRouter router, RouteInfo route) { if (route.getId().equals(mCurrentRoute.getId())) { selectRoute(route); - new CreateNotificationTask().execute(mPlaylist.get(mCurrentTrack) - .getFirstPropertyValue(DIDLObject.Property.UPNP.ALBUM_ART_URI.class)); + if (mCurrentTrack >= 0 && mCurrentTrack < mPlaylist.size()) { + new CreateNotificationTask().execute(mPlaylist.get(mCurrentTrack) + .getFirstPropertyValue(DIDLObject.Property.UPNP.ALBUM_ART_URI.class)); + } } } };