title: Android FragmentManager BackStackRecord.run throwing NullPointerException
body: <p>I sometimes get the following exception when working with Fragments:</p>
  
  <pre class="lang-none prettyprint-override"><code>FATAL EXCEPTION: main
  java.lang.NullPointerException
      at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:591)
      at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1416)
      at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:420)
      at android.os.Handler.handleCallback(Handler.java:615)
      at android.os.Handler.dispatchMessage(Handler.java:92)
      at android.os.Looper.loop(Looper.java:137)
      at android.app.ActivityThread.main(ActivityThread.java:4745)
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:511)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
      at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>The exception occurs when <code>run()</code> of <code>BackStackRecord</code> is called through <code>execPendingTransactions()</code>, when it tries to remove a fragment from the manager.</p>
  
  <pre><code>case OP_REMOVE: {
    Fragment f = op.fragment;
    f.mNextAnim = op.exitAnim; &lt;----
    mManager.removeFragment(f, mTransition, mTransitionStyle);
  }
  break;
  </code></pre>
  
  <p>I can't seem to figure out what exactly is causing this? I think it has to do with the backstack of fragments not being cleaned up right when removing fragments.</p>