2
0
mirror of synced 2025-01-25 22:00:22 +00:00

[ios][database] Protect against calling off on a non-existent ref

This commit is contained in:
Chris Bianca 2017-10-18 10:29:11 +01:00
parent 31854bae5b
commit 4f51b48430

View File

@ -246,12 +246,14 @@ RCT_EXPORT_METHOD(on:(NSString *) appName
RCT_EXPORT_METHOD(off:(NSString *) key
eventRegistrationKey:(NSString *) eventRegistrationKey) {
RNFirebaseDatabaseReference *ref = _dbReferences[key];
if (ref) {
[ref removeEventListener:eventRegistrationKey];
if (![ref hasListeners]) {
[_dbReferences removeObjectForKey:key];
}
}
}