WhiskeySockets / Baileys

Lightweight full-featured typescript/javascript WhatsApp Web API
https://baileys.whiskeysockets.io/
MIT License
4.07k stars 1.38k forks source link

fix: prevent TypeError when accessing 'cachedGroupMetadata' in sendMe… #1110

Open tiagomatrixd opened 3 weeks ago

tiagomatrixd commented 3 weeks ago

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:

Why:

whiskeysockets-bot commented 3 weeks ago

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