title: Adding a contact group gives NullPointerexception on HTC and Samsung devices
body: <p>I'm trying to add a contacts group with a <code>ContentProviderOperation</code>. This works on Nexus, Moto G and Asus devices but it crashes on HTC M7, M8, M8 mini and M9, Samsung S4, S5. Because I only have the sources of the normal clean Android I can't find what the Nullpointer is causing by debugging.</p>
  
  <p>None of the values I use in this <code>ContentProviderOperation</code> are null.
  The groups are added to a custom account type specified in authenticator.xml.</p>
  
  <p>Code:</p>
  
  <pre><code>public Uri addContactGroup(String title, boolean autoAdd, boolean isReadOnly, boolean isVisible){
      ArrayList&lt;ContentProviderOperation&gt; ops = new ArrayList&lt;&gt;();
  
      ops.add(ContentProviderOperation
              .newInsert(ContactsContract.Groups.CONTENT_URI)
              .withValue(ContactsContract.Groups.TITLE, title)
              .withValue(ContactsContract.Groups.ACCOUNT_TYPE, getAccount().type)
              .withValue(ContactsContract.Groups.ACCOUNT_NAME, getAccount().name)
              .withValue(ContactsContract.Groups.AUTO_ADD, autoAdd)
              .withValue(ContactsContract.Groups.GROUP_IS_READ_ONLY, isReadOnly)
              .withValue(ContactsContract.Groups.GROUP_VISIBLE, isVisible)
              .build());
      try {
          ContentProviderResult[] result = mContext.getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
          if(result.length &gt; 0) {
              return result[0].uri;
          }
      } catch (RemoteException | OperationApplicationException e){
          Log.e(TAG, e.toString());
      }
      return null;
  }
  </code></pre>
  
  <p>Throws this exception:</p>
  
  <blockquote>
    <p>java.lang.NullPointerException: Attempt to invoke virtual method 'int
    java.lang.Integer.intValue()' on a null object reference
                at android.os.Parcel.readException(Parcel.java:1555)
                at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
                at android.database.DatabaseUtils.readExceptionWithOperationApplicationExceptionFromParcel(DatabaseUtils.java:160)
                at android.content.ContentProviderProxy.applyBatch(ContentProviderNative.java:573)
                at android.content.ContentProviderClient.applyBatch(ContentProviderClient.java:377)
                at android.content.ContentResolver.applyBatch(ContentResolver.java:1265)
                at nl.dalvikvm.stackoverflowquestion.content.proces.CardProcess.addContactGroup(CardProcess.java:284)
                at nl.dalvikvm.stackoverflowquestion.content.proces.CardProcess.initGroups(CardProcess.java:244)
                at nl.dalvikvm.stackoverflowquestion.sync.SyncUtils.CreateSyncAccount(SyncUtils.java:55)
                at nl.dalvikvm.stackoverflowquestion.ui.MainActivity$1.run(MainActivity.java:288)
                at java.lang.Thread.run(Thread.java:818)</p>
  </blockquote>