imperiumlabs / GeoFirestore-Android

GeoFirestore for Android - Realtime location queries with Firestore
MIT License
123 stars 37 forks source link

Got DocumentSnapshow without location with key... #16

Closed AlexPuhalschi closed 5 years ago

AlexPuhalschi commented 5 years ago

Hey, I have cases when "l" is saved as map instead of array, on IOS version of library, document with such "l" value is just ignored, on Android it throws java.lang.AssertionError: Got DocumentSnapshot without location with key documentId, can you fix it so library will just got past it or onError will be called, it will be really useful. Bellow is error code:

` java.lang.AssertionError: Got DocumentSnapshot without location with key documentId
    at org.imperiumlabs.geofirestore.GeoQuery.childAdded(GeoQuery.java:293)
    at org.imperiumlabs.geofirestore.GeoQuery.access$400(GeoQuery.java:23)
    at org.imperiumlabs.geofirestore.GeoQuery$6.onEvent(GeoQuery.java:232)
    at org.imperiumlabs.geofirestore.GeoQuery$6.onEvent(GeoQuery.java:226)
    at com.google.firebase.firestore.zzi.onEvent(Unknown Source:1789)
    at com.google.firebase.firestore.g.zzh.zza(SourceFile:28)
    at com.google.firebase.firestore.g.zzi.run(Unknown Source:6)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6863)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)`

Code where error is being thrown from library is this: private void childAdded(DocumentSnapshot documentSnapshot) { GeoPoint location = GeoFirestore.getLocationValue(documentSnapshot); if (location != null) { this.updateLocationInfo(documentSnapshot, location); } else { throw new AssertionError("Got DocumentSnapshot without location with key " + documentSnapshot.getId()); } }

Can't we just delete else option? P.S: I know I should just check and change document with problem, but that is not always possible to do fast.

AlexPuhalschi commented 5 years ago

Issue was fixed in library version 1.2.1, @theonlynick0430 can you close this issue?

Supercaly commented 5 years ago

Close because the issue is fixed in v1.2.0