From 01a8ac25c98d792da0e41601cad64e28411a2538 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 8 Sep 2020 17:40:57 +0100 Subject: [PATCH] Use null coalescing operator --- src/utils/WidgetUtils.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/utils/WidgetUtils.js b/src/utils/WidgetUtils.js index 771bc0887a..d1daba7ca5 100644 --- a/src/utils/WidgetUtils.js +++ b/src/utils/WidgetUtils.js @@ -480,13 +480,11 @@ export default class WidgetUtils { } static getWidgetName(app) { - if (!app || !app.name) return ""; - return app.name.trim() || _t("Unknown App"); + return app?.name?.trim() || _t("Unknown App"); } static getWidgetDataTitle(app) { - if (!app || !app.data || !app.data.title) return ""; - return app.data.title.trim(); + return app?.data?.title?.trim() || ""; } static editWidget(room, app) {