usync: status-protocol being undefined
it was getting undefined for some users
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@AliAryanTech/Baileys#patch-1
# YARN v2
yarn add @whiskeysockets/baileys@AliAryanTech/Baileys#patch-1
I see no difference in safely trying toString an undefined object, but it doesn't change the fact the object could still be undefined, just that Rajeh loves using the forbidden null assertion
when dealing with string content, it's better to use ? to avoid runtime errors...
for me, this isn’t a critical issue, but it’s definitely a good suggestion..
we’re always open to suggestions for improvement.
I see no difference in safely trying
toStringan undefined object, but it doesn't change the fact the object could still be undefined, just that Rajeh loves using the forbidden null assertion
This is not the case here, since the node is already vetted (the tag is defined, it is error free), there's literally no reason to use a question mark operator. Regardless, it is a good idea for code quality alone.
This is not the case here, since the node is already vetted (the tag is defined, it is error free), there's literally no reason to use a question mark operator. Regardless, it is a good idea for code quality alone.
Understood
I see no difference in safely trying
toStringan undefined object, but it doesn't change the fact the object could still be undefined, just that Rajeh loves using the forbidden null assertionThis is not the case here, since the node is already vetted (the tag is defined, it is error free), there's literally no reason to use a question mark operator. Regardless, it is a good idea for code quality alone.
It got undefined, You can see logs in screenshot. that's why we need to fix it
It got undefined, You can see logs in screenshot. that's why we need to fix it
@AliAryanTech You seem not to understand, whether you use safely access the object or you don't, if the data is undefined it will be undefined, as @purpshell had already said, node is already vetted and for you to use the ? question mark operator will just there for code quality reasons
The screenshot clearly shows a TypeError: Cannot read properties of undefined (reading 'toString'), which occurs because node or node.content is undefined at runtime, While the assumption is that node is vetted, this error demonstrates that it’s not guaranteed to be defined in all cases. Adding the optional chaining operator (?.) isn’t just for code quality.
it prevents this crash and ensures the code handles unexpected undefined values gracefully. I believe this fix is necessary for robustness, and the pull request should be accepted to avoid such runtime errors in the future. @purpshell @AstroX11
@azudindaem approve it
The screenshot clearly shows a
TypeError: Cannot read properties of undefined (reading 'toString'), which occurs becausenodeornode.contentisundefinedat runtime, While the assumption is thatnodeis vetted, this error demonstrates that it’s not guaranteed to be defined in all cases. Adding the optional chaining operator (?.) isn’t just for code quality.it prevents this crash and ensures the code handles unexpected
undefinedvalues gracefully. I believe this fix is necessary for robustness, and the pull request should be accepted to avoid such runtime errors in the future. @purpshell @AstroX11
Ok
why it's not merge yet?
This is not a critical issue..
why it's not merge yet?
lol