Handle optional chaining for 'settings.msg_call', this change prevents 'TypeError: Cannot read properties of undefined' errors when 'msg_call' is undefined.

This commit is contained in:
Vitor 2023-10-27 22:49:57 -03:00
parent d0a5ae1da4
commit 52d6a563d6

View File

@ -1801,7 +1801,7 @@ export class WAStartupService {
this.client.rejectCall(call.id, call.from);
}
if (settings?.msg_call.trim().length > 0 && call.status == 'offer') {
if (settings?.msg_call?.trim().length > 0 && call.status == 'offer') {
this.logger.verbose('Sending message in call');
const msg = await this.client.sendMessage(call.from, {
text: settings.msg_call,