title: NullPointerException in FragmentManager
body: <p>I'm using the Android compatibility library and occasionally get a weird <code>NullPointerException</code>:</p>
  
  <pre><code>java.lang.NullPointerException
      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:960)
      at android.support.v4.app.FragmentManagerImpl.performPendingDeferredStart(FragmentManager.java:768)
      at android.support.v4.app.FragmentManagerImpl.startPendingDeferredFragments(FragmentManager.java:1104)
      at android.support.v4.app.LoaderManagerImpl$LoaderInfo.onLoadComplete(LoaderManager.java:410)
      at android.support.v4.content.Loader.deliverResult(Loader.java:103)
      at android.support.v4.content.CursorLoader.deliverResult(CursorLoader.java:81)
      at android.support.v4.content.CursorLoader.onStartLoading(CursorLoader.java:126)
      at android.support.v4.content.Loader.startLoading(Loader.java:197)
      at android.support.v4.app.LoaderManagerImpl$LoaderInfo.start(LoaderManager.java:262)
      at android.support.v4.app.LoaderManagerImpl.doStart(LoaderManager.java:710)
      at android.support.v4.app.Fragment.onStart(Fragment.java:981)
      at android.support.v4.app.Fragment.performStart(Fragment.java:1332)
      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:906)
      at android.support.v4.app.FragmentManagerImpl.attachFragment(FragmentManager.java:1240)
      at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:612)
      at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1416)
      at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:431)
      at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:139)
      at android.support.v4.view.ViewPager.populate(ViewPager.java:804)
      at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:433)
      at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:405)
      at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:386)
      ...
  </code></pre>
  
  <p>Obviously, I'm doing <strong>something</strong> wrong to allow the <code>FragmentManager</code> to get into such a state where it can crash like this, but I have no clue what. The <a href="https://github.com/grantland/android-support-v4/blob/master/src/java/android/support/v4/app/FragmentManager.java#L960" rel="noreferrer">relevant code</a> in the <code>FragmentManagerImpl</code> is not offering me any clues. I'm guessing <code>mActivity</code> is somehow <code>null</code> at that point in the code? But that seems impossible as the activity is already on the screen and I'm not adding any fragments to it — just switching among them in a <code>ViewPager</code>.</p>