File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
Example/Tests/Integration/API Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -568,6 +568,15 @@ - (void)testSnapshotsInSyncListenerFiresAfterListenersInSync {
568
568
[self writeDocumentRef: ref data: @{@" foo" : @3 }];
569
569
}
570
570
571
+ - (void )testSnapshotsInSyncRemoveIsIdempotent {
572
+ // This test merely verifies that calling remove multiple times doesn't
573
+ // explode.
574
+ auto listener = [self .db addSnapshotsInSyncListener: ^(){
575
+ }];
576
+ [listener remove ];
577
+ [listener remove ];
578
+ }
579
+
571
580
- (void )testListenCanBeCalledMultipleTimes {
572
581
FIRCollectionReference *coll = [self .db collectionWithPath: @" collection" ];
573
582
FIRDocumentReference *doc = [coll documentWithAutoID ];
Original file line number Diff line number Diff line change @@ -36,10 +36,12 @@ void SnapshotsInSyncListenerRegistration::Remove() {
36
36
if (async_listener) {
37
37
async_listener->Mute ();
38
38
async_listener_.reset ();
39
- }
40
39
41
- client_->RemoveSnapshotsInSyncListener (async_listener);
42
- client_.reset ();
40
+ if (client_) {
41
+ client_->RemoveSnapshotsInSyncListener (async_listener);
42
+ client_.reset ();
43
+ }
44
+ }
43
45
}
44
46
45
47
} // namespace api
You can’t perform that action at this time.
0 commit comments