OSDN Git Service

Fix NPE in music app.
authorMarco Nelissen <marcone@google.com>
Wed, 10 Jun 2009 19:43:25 +0000 (12:43 -0700)
committerMarco Nelissen <marcone@google.com>
Wed, 10 Jun 2009 19:43:25 +0000 (12:43 -0700)
src/com/android/music/MediaPlaybackService.java

index 995a050..f44d5f3 100644 (file)
@@ -400,8 +400,8 @@ public class MediaPlaybackService extends Service {
             // the same one as when the playlist was saved
             q = mPreferences.getString("queue", "");
         }
-        int qlen = q.length();
-        if (q != null && qlen > 1) {
+        int qlen = q != null ? q.length() : 0;
+        if (qlen > 1) {
             //Log.i("@@@@ service", "loaded queue: " + q);
             int plen = 0;
             int n = 0;