-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed crash by adding a nil-pointer check. #1098
Conversation
Hi @mikepulaski, thank you for your contribution. About your changes, in my opinion, it doesn't need a nil-pointer check because Objective-C won't produce a crash when the listener reference is |
@ricardopereira Yeah, I think you're right because we still get the crash I was trying to fix with this :) I suspect a similar fix is probably needed, though. I suspect the Something like: - (void)startTimer {
ARTEventEmitter *eventHandler = _eventHandler;
if (eventHandler == nil) {
return;
}
// ...
} |
@mikepulaski Did you tried the tentative fix from #1089? |
@ricardopereira Nope! It's not something we've been able to reproduce ourselves, unfortunately. We have quite a few people running our app daily so we see some weird edge cases pop up in the wild. This one is our most frequent, unfortunately. It looks like your fix is more or less what I was suggesting, but a potential problem is that a nil-check alone wouldn't fix the crash if it happened to dealloc on another queue/thread while this code block is running, which is possible since it's a weak reference. That's why I thought making a local strong reference before checking if it's nil might do the trick. |
I'm hoping to attend to this soon. See my comment on your other pull request. |
@mikepulaski Sorry for the delay. Is there any chance you could rebase atop our updated |
Calling
[ARTRealtime transitionSideEffects:]
while in a failed connection state returns a nil reference toARTEventListener*
.This PR adds a nil-pointer check to avoid a crash, which fixes #1083.