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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mhughdo
Copy link

@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.

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.

None yet

1 participant