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: prevent TypeError when accessing 'cachedGroupMetadata' in sendMe… #1110

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

Conversation

tiagomatrixd
Copy link

This PR fixes a TypeError that occurred when trying to check for 'cachedGroupMetadata' in the 'sendMessage' function options.

The error was caused by attempting to use the 'in' operator on an undefined or null value. This fix adds a type check to ensure 'options' is an object before using the 'in' operator.

Changes:

  • Add a type check for 'options' to avoid errors when 'options' is undefined.

Why:

  • This prevents crashes and unexpected behavior when 'sendMessage' is called with invalid options.

@whiskeysockets-bot
Copy link
Contributor

Thanks for your contribution.

The next step is to wait for review and approval to merge it to main repository

The community can help reacting with a thumb up (:thumbsup:) for approval and rocket (:rocket:) for who has tested it.

To test this PR you can run the following command below:

# NPM
npm install @whiskeysockets/baileys@tiagomatrixd/Baileys#master
# YARN v2
yarn add @whiskeysockets/baileys@tiagomatrixd/Baileys#master

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