File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Branch-SDK/Branch-SDK/Networking Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ - (id)init {
4242}
4343
4444- (void ) dealloc {
45+ if (self.persistTimer )
46+ dispatch_source_cancel (self.persistTimer );
4547 [self persistImmediately ];
4648}
4749
@@ -237,7 +239,7 @@ - (void)persistEventually {
237239 );
238240 __weak __typeof (self) weakSelf = self;
239241 dispatch_source_set_event_handler (self.persistTimer , ^ {
240- __strong __typeof (self ) strongSelf = weakSelf;
242+ __strong __typeof (weakSelf ) strongSelf = weakSelf;
241243 if (strongSelf) {
242244 [strongSelf persistImmediately ];
243245 dispatch_source_cancel (strongSelf.persistTimer );
@@ -250,8 +252,9 @@ - (void)persistEventually {
250252
251253- (void )persistImmediately {
252254 @synchronized (self) {
253- NSArray *requestsToPersist = [self .queue copy ];
254255 @try {
256+ if (!self.queue ) return ;
257+ NSArray *requestsToPersist = [self .queue copy ];
255258 NSMutableArray *encodedRequests = [[NSMutableArray alloc ] init ];
256259 for (BNCServerRequest *req in requestsToPersist) {
257260 // Don't persist these requests
You can’t perform that action at this time.
0 commit comments