fix: add null checks for plugin and settings to prevent TypeError

This commit is contained in:
Mohamed Chedli 2024-11-22 18:26:36 +01:00
parent 485744e1e5
commit 08c0e8b612

View File

@ -59,7 +59,7 @@ export class TranslationService extends BaseService<Translation> {
// plugin // plugin
Object.entries(block.message.args).forEach(([l, arg]) => { Object.entries(block.message.args).forEach(([l, arg]) => {
const setting = plugin.settings.find(({ label }) => label === l); const setting = plugin?.settings.find(({ label }) => label === l);
if (setting?.translatable) { if (setting?.translatable) {
if (Array.isArray(arg)) { if (Array.isArray(arg)) {
// array of text // array of text