OSDN Git Service

Fix more bugs when no music is present.
authorMarco Nelissen <marcone@google.com>
Sat, 12 Dec 2009 22:07:59 +0000 (14:07 -0800)
committerMarco Nelissen <marcone@google.com>
Sat, 12 Dec 2009 22:07:59 +0000 (14:07 -0800)
src/com/android/music/AlbumBrowserActivity.java
src/com/android/music/ArtistAlbumBrowserActivity.java
src/com/android/music/PlaylistBrowserActivity.java
src/com/android/music/TrackBrowserActivity.java

index bfa683e..ba3e212 100644 (file)
@@ -156,7 +156,10 @@ public class AlbumBrowserActivity extends ListActivity
         ListView lv = getListView();
         if (lv != null) {
             mLastListPosCourse = lv.getFirstVisiblePosition();
-            mLastListPosFine = lv.getChildAt(0).getTop();
+            View cv = lv.getChildAt(0);
+            if (cv != null) {
+                mLastListPosFine = cv.getTop();
+            }
         }
         MusicUtils.unbindFromService(this);
         if (!mAdapterSent) {
index 46afeda..0fd7735 100644 (file)
@@ -162,7 +162,10 @@ public class ArtistAlbumBrowserActivity extends ExpandableListActivity
         ExpandableListView lv = getExpandableListView();
         if (lv != null) {
             mLastListPosCourse = lv.getFirstVisiblePosition();
-            mLastListPosFine = lv.getChildAt(0).getTop();
+            View cv = lv.getChildAt(0);
+            if (cv != null) {
+                mLastListPosFine = cv.getTop();
+            }
         }
         
         MusicUtils.unbindFromService(this);
index edd8d4f..447c75b 100644 (file)
@@ -177,7 +177,10 @@ public class PlaylistBrowserActivity extends ListActivity
         ListView lv = getListView();
         if (lv != null) {
             mLastListPosCourse = lv.getFirstVisiblePosition();
-            mLastListPosFine = lv.getChildAt(0).getTop();
+            View cv = lv.getChildAt(0);
+            if (cv != null) {
+                mLastListPosFine = cv.getTop();
+            }
         }
         MusicUtils.unbindFromService(this);
         if (!mAdapterSent) {
index 53fc34d..8f33958 100644 (file)
@@ -236,7 +236,10 @@ public class TrackBrowserActivity extends ListActivity
         ListView lv = getListView();
         if (lv != null) {
             mLastListPosCourse = lv.getFirstVisiblePosition();
-            mLastListPosFine = lv.getChildAt(0).getTop();
+            View cv = lv.getChildAt(0);
+            if (cv != null) {
+                mLastListPosFine = cv.getTop();
+            }
         }
         MusicUtils.unbindFromService(this);
         try {