Skip to content

Commit 2cfde4a

Browse files
authored
Merge pull request #48 from devshackio/master
Fix startAt, endAt, equalTo optional 2nd param for Android getDatabaseQueryAtPathAndModifiers
2 parents 4a97bde + dc4b7af commit 2cfde4a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

android/src/main/java/io/fullstack/firestack/FirestackDatabase.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,23 +247,23 @@ private Query getDatabaseQueryAtPathAndModifiers(final ReadableArray modifiers)
247247
query = query.limitToFirst(limit);
248248
} else if (methStr.contains("equalTo")) {
249249
String value = strArr[1];
250-
String key = strArr[2];
250+
String key = strArr.length >= 3 ? strArr[2] : null;
251251
if (key == null) {
252252
query = query.equalTo(value);
253253
} else {
254254
query = query.equalTo(value, key);
255255
}
256256
} else if (methStr.contains("endAt")) {
257257
String value = strArr[1];
258-
String key = strArr[2];
258+
String key = strArr.length >= 3 ? strArr[2] : null;
259259
if (key == null) {
260260
query = query.endAt(value);
261261
} else {
262262
query = query.endAt(value, key);
263263
}
264264
} else if (methStr.contains("startAt")) {
265265
String value = strArr[1];
266-
String key = strArr[2];
266+
String key = strArr.length >= 3 ? strArr[2] : null;
267267
if (key == null) {
268268
query = query.startAt(value);
269269
} else {

0 commit comments

Comments
 (0)