Skip to content

Commit

Permalink
Merge pull request #1098 from tupleapp/client-failed-crash-fix
Browse files Browse the repository at this point in the history
Fixed crash by adding a nil-pointer check.
  • Loading branch information
QuintinWillison authored Apr 26, 2021
2 parents eaf1063 + 378f8da commit eb87043
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Source/ARTRealtime.m
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,10 @@ - (void)transition:(ARTRealtimeConnectionState)state withErrorInfo:(ARTErrorInfo

[_internalEventEmitter emit:[ARTEvent newWithConnectionEvent:(ARTRealtimeConnectionEvent)state] with:stateChange];

[stateChangeEventListener startTimer];
// stateChangeEventListener may be nil if we're in a failed state
if (stateChangeEventListener != nil) {
[stateChangeEventListener startTimer];
}
}

- (void)transitionToDisconnectedOrSuspended {
Expand Down Expand Up @@ -511,7 +514,10 @@ - (void)updateWithErrorInfo:(nullable ARTErrorInfo *)errorInfo {

ARTEventListener *stateChangeEventListener = [self transitionSideEffects:stateChange];

[stateChangeEventListener startTimer];
// stateChangeEventListener may be nil if we're in a failed state
if (stateChangeEventListener != nil) {
[stateChangeEventListener startTimer];
}
}

- (ARTEventListener *)transitionSideEffects:(ARTConnectionStateChange *)stateChange {
Expand Down

0 comments on commit eb87043

Please sign in to comment.