OSDN Git Service

Eleven - Fix the PlaylistDetailFragment crash
authorlinus_lee <llee@cyngn.com>
Fri, 31 Oct 2014 23:54:38 +0000 (16:54 -0700)
committerlinus_lee <llee@cyngn.com>
Thu, 20 Nov 2014 20:51:36 +0000 (12:51 -0800)
https://cyanogen.atlassian.net/browse/MUSIC-154

Change-Id: Ifd27b231b0d98df0133f961c0b4bcd5a7c0dfbbc

src/com/cyngn/eleven/ui/fragments/PlaylistDetailFragment.java

index 06afd54..8e13067 100644 (file)
@@ -366,8 +366,15 @@ public class PlaylistDetailFragment extends FadingBarFragment implements
             getContainingActivity().postRemoveFragment(this);
             return;
         }
-        // update action bar title and popup menu handler
-        ((PlaylistPopupMenuHelper)mActionMenuHelper).updateName(mPlaylistName);
+
+        // since onCreateOptionsMenu can be called after onCreate it is possible for
+        // mActionMenuHelper to be null.  In this case, don't bother updating the Name since when
+        // it does create it, it will use the updated name anyways
+        if (mActionMenuHelper != null) {
+            // update action bar title and popup menu handler
+            ((PlaylistPopupMenuHelper) mActionMenuHelper).updateName(mPlaylistName);
+        }
+
         getContainingActivity().setActionBarTitle(mPlaylistName);
         // and reload the song list
         getLoaderManager().restartLoader(0, getArguments(), this);