title: Cloud Firestore - QuerySnapshot.toObjects Throws Null Pointer Exception
body: <p>I've stumbled upon a strange problem. I'm trying to accomplish a simple thing - convert everything from a QuerySnapshot to a collection of a certain type.</p>
  
  <pre><code>fun createReminder(reminder: Reminder) = 
      remindersCollectionRef.document("${reminder.taskId}").set(reminder)
  
  fun tryRemoveReminder(taskId: Int) = 
      remindersCollectionRef.document("$taskId").delete()
  
  fun getReminders(onComplete: (List&lt;Reminder&gt;) -&gt; Unit) {
      remindersCollectionRef.get()
          .addOnSuccessListener { querySnapshot -&gt;
              if (!querySnapshot.isEmpty)
                   onComplete(querySnapshot.toObjects(Reminder::class.java))
              }
          }
  </code></pre>
  
  <p>The problem is in the getReminders function. I know that there is one reminder in the collection. It is also 100% of type Reminder and as you can see I already check if querySnapshot is not empty. Still, I get a null pointer exception when I call toObjects.</p>
  
  <p>Stack trace:</p>
  
  <pre><code>java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.reflect.Constructor.newInstance(java.lang.Object[])' on a null object reference
  at com.google.android.gms.internal.zzevb$zza.zza(Unknown Source:57)
  at com.google.android.gms.internal.zzevb.zza(Unknown Source:1025)
  at com.google.android.gms.internal.zzevb.zza(Unknown Source:2)
  at com.google.firebase.firestore.DocumentSnapshot.toObject(Unknown Source:10)
  at com.google.firebase.firestore.QuerySnapshot.toObjects(Unknown Source:27)
  at com.mypackage.util.FirestoreUtil$Companion$getReminders$1.onSuccess(FirestoreUtil.kt:131)
  at com.mypackage.util.FirestoreUtil$Companion$getReminders$1.onSuccess(FirestoreUtil.kt:18)
  at com.google.android.gms.tasks.zzj.run(Unknown Source:27)
  at android.os.Handler.handleCallback(Handler.java:789)
  at android.os.Handler.dispatchMessage(Handler.java:98)
  at android.os.Looper.loop(Looper.java:164)
  at android.app.ActivityThread.main(ActivityThread.java:6541)                                                                                      at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
  </code></pre>
  
  <p>Reminder class:</p>
  
  <pre><code>data class Reminder(val taskDocRef: DocumentReference, val taskId: Int)
  </code></pre>
  
  <p>This issue seems really strange to me. I will appreciate your help :)  </p>