Use null coalescing operator

pull/21833/head
Michael Telatynski 2020-09-08 17:40:57 +01:00
parent a17b2ba1e5
commit 01a8ac25c9
1 changed files with 2 additions and 4 deletions

View File

@ -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) {