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 nil pointer panic #94

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

unstppbl
Copy link

@unstppbl unstppbl commented Jan 2, 2025

When receiving an update from the Telegram API that is not related to a new message, the app crashes with a nil pointer error. This happens because the code assumes that every update has a non-nil Message field, which is not always the case.

Change Description:
• Added a condition to check if the Message field in the update is nil.
• Logged a message (“memo message is nil”) and safely returned early when the condition is met.
• This prevents the app from crashing due to a nil pointer error when the update is not about a new message.

Impact:
• Ensures the app handles updates without a Message field gracefully.
• Improves the app’s robustness by avoiding unnecessary panics.

@unstppbl
Copy link
Author

unstppbl commented Jan 2, 2025

image

Copy link
Contributor

@johnnyjoygh johnnyjoygh left a comment

Choose a reason for hiding this comment

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

LGTM

memogram.go Outdated Show resolved Hide resolved
change log message type

Co-authored-by: Johnny <[email protected]>
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