Skip to content
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

fix: check if the channel is closed before returning ws.result to prevent panic #198

Conversation

mhughdo
Copy link
Contributor

@mhughdo mhughdo commented Apr 21, 2024

Overview

  • If sub.Unsubscribe() func is not called properly, it could cause panic:
    panic: interface conversion: ws.result is nil, not *ws.LogResult

  • It's due to Recv() receiving values from the closed channel. I think it's better to handle this case instead of letting it panic.

Changes

  • Checking if the channel is closed before returning the value.

@gagliardetto gagliardetto merged commit 6beb7f8 into gagliardetto:main Oct 10, 2024
@gagliardetto
Copy link
Owner

thank you!

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.

2 participants