Skip to content

Commit

Permalink
fix: nil dynamic config refresh crash (#288) (#289)
Browse files Browse the repository at this point in the history
Abort execution of completion block after dynamic config refresh completes if self is now nil

Co-authored-by: Jamie Altreuter <[email protected]>
  • Loading branch information
jaltreuter and Jamie Altreuter authored Oct 7, 2020
1 parent dc65001 commit 9dc896d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Sources/Amplitude/Amplitude.m
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,9 @@ - (void)refreshDynamicConfig {
__weak typeof(self) weakSelf = self;
[[AMPConfigManager sharedInstance] refresh:^{
__strong typeof(self) strongSelf = weakSelf;
if (strongSelf == nil) {
return;
}
strongSelf->_serverUrl = [AMPConfigManager sharedInstance].ingestionEndpoint;
}];
}
Expand Down

0 comments on commit 9dc896d

Please sign in to comment.