Skip to content

fix: handle undefined channelMetadata to prevent crash#127094

Merged
BenyFilho merged 13 commits intowwebjs:mainfrom
wallacefrota:fix/channel-metadata-undefined
Mar 24, 2026
Merged

fix: handle undefined channelMetadata to prevent crash#127094
BenyFilho merged 13 commits intowwebjs:mainfrom
wallacefrota:fix/channel-metadata-undefined

Conversation

@wallacefrota
Copy link
Copy Markdown
Contributor

@wallacefrota wallacefrota commented Mar 4, 2026

Description

Fixes a crash when channelMetadata is undefined in Channel structure.

Issue

Some WhatsApp responses do not include channelMetadata, causing:

TypeError: Cannot read properties of undefined (reading 'description')

Solution

Added safe access guard before reading description.

Testing

  • Client startup
  • Group messages
  • Channel presence

@github-actions github-actions Bot added the api changes API modifications label Mar 16, 2026
@BenyFilho BenyFilho added approved Confirmed by maintainers and removed api changes API modifications labels Mar 16, 2026
@BenyFilho BenyFilho changed the title 💥 fix(Channel): handle undefined channelMetadata to prevent crash fix: handle undefined channelMetadata to prevent crash Mar 16, 2026
@github-actions github-actions Bot added the api changes API modifications label Mar 16, 2026
@wallacefrota wallacefrota force-pushed the fix/channel-metadata-undefined branch from 0cbc6e0 to 0d464c2 Compare March 19, 2026 14:21
@BenyFilho
Copy link
Copy Markdown
Member

I edit the files directly on git, but Prettier is killing me

@2hoch1
Copy link
Copy Markdown
Member

2hoch1 commented Mar 19, 2026

I edit the files directly on git, but Prettier is killing me

You are a criminal

Copy link
Copy Markdown
Contributor Author

@wallacefrota wallacefrota left a comment

Choose a reason for hiding this comment

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

Updated, check lint

@wallacefrota wallacefrota force-pushed the fix/channel-metadata-undefined branch from 470d66d to 752852a Compare March 20, 2026 19:12
@BenyFilho BenyFilho merged commit 7f54af0 into wwebjs:main Mar 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api changes API modifications approved Confirmed by maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants