Skip to content

fix(iOS): Fix crash when localPort or connectedPort is null #172

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Yahui-Ren
Copy link

image

image

It will send an error event when connectedPort or localPort is null

@Rapsssito Rapsssito closed this May 31, 2023
@landabaso
Copy link

Hi @Rapsssito, could you please explain why this was closed?
From my experience, this PR seems to resolve #197, but I understand you might feel that the proposed approach is not correct.
Could you please share what issues you see with this fix and suggest a new or better approach?

@Rapsssito Rapsssito reopened this Apr 24, 2025
@Rapsssito
Copy link
Owner

@landabaso, sorry for closing this without any explanation. I have added my review.

Comment on lines -140 to -142
} else {
// Default certificates
[settings setObject:_host forKey:(NSString *)kCFStreamSSLPeerName];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should the default certificates be removed?

Comment on lines +188 to +189
if([socket localHost] != nil && [socket connectedHost] != nil && [socket localPort] != nil
&& [socket connectedPort] != nil) {
Copy link
Owner

@Rapsssito Rapsssito Apr 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes #197, but what is the reason behind these properties being nil?

Comment on lines +205 to +207
NSString *msg =
[NSString stringWithFormat:@"no client found with id %@", client.id];
[self sendEventWithName:@"error" body:@{@"id" : client.id, @"error" : msg}];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the correct error message?

@Rapsssito Rapsssito changed the title fix crash for ios when localPort or connectedPort is null fix(iOS9: Fix crash when localPort or connectedPort is null Apr 24, 2025
@Rapsssito Rapsssito changed the title fix(iOS9: Fix crash when localPort or connectedPort is null fix(iOS): Fix crash when localPort or connectedPort is null Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants