title: Parcel crashes when retrieved from Intent
body: <p>In analytics for our app we've noticed increased number of crashes for the <code>getIntent().getExtras()</code> calls. It's intermittent and we can't replicate that.</p>
  
  <p>Crashes come in two flavours:</p>
  
  <pre><code>12  Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.os.Parcel.dataSize()' on a null object reference
  13  at android.os.BaseBundle.&lt;init&gt;(BaseBundle.java:126)
  14  at android.os.Bundle.&lt;init&gt;(Bundle.java:102)
  15  at android.content.Intent.getExtras(Intent.java:5685)
  </code></pre>
  
  <p>and</p>
  
  <pre><code>12  Caused by: java.lang.IllegalArgumentException
  13  at android.os.Parcel.nativeAppendFrom(Native Method)
  14  at android.os.Parcel.appendFrom(Parcel.java:458)
  15  at android.os.BaseBundle.&lt;init&gt;(BaseBundle.java:126)
  16  at android.os.Bundle.&lt;init&gt;(Bundle.java:102)
  17  at android.content.Intent.getExtras(Intent.java:5685)
  </code></pre>
  
  <p>Retrieving code is essentially as follows <code>onResume() {... getIntent().getExtras() ...}</code>. We check if the bundle in not null but it crashes before that.</p>
  
  <p>We do pass a custom parcelable but extensive unit tests are passing for marshalling and unmarshalling that.</p>
  
  <p>Interesting stats for those crashes are that it mostly happen for Android 6+ (72% of sessions recorded with 95% of crashes happen there). Also unexpectedly crash rarely happens on Samsung devices (73% of sessions recorded with only 10% crashes happen for that manufacturer).</p>
  
  <p>This crash contibutes ~0.15% to the app crashrate with a rising trend (probably because increasing number or users on API23+).</p>
  
  <p>Anyone encountered something similar or has a solution already?</p>