Use null coalescing operator

This commit is contained in:
Michael Telatynski 2020-09-08 17:40:57 +01:00
parent a17b2ba1e5
commit 01a8ac25c9

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