Skip to content

Commit bd770e1

Browse files
committed
calendar applet: Fix handling for invalid clock formats.
Error handling was insufficient and could leave the applet unusable. Fixes #13635
1 parent 31736d8 commit bd770e1

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

  • files/usr/share/cinnamon/applets/calendar@cinnamon.org

files/usr/share/cinnamon/applets/calendar@cinnamon.org/applet.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,9 @@ class CinnamonCalendarApplet extends Applet.TextApplet {
266266
label_string = this.clock.get_clock_for_format(this.custom_format);
267267
}
268268

269+
if (label_string)
270+
this.set_applet_label(label_string);
271+
269272
this.go_home_button.reactive = !this._calendar.todaySelected();
270273
if (this._calendar.todaySelected()) {
271274
this.go_home_button.reactive = false;
@@ -275,12 +278,11 @@ class CinnamonCalendarApplet extends Applet.TextApplet {
275278
this.go_home_button.set_style_class_name("calendar-today-home-button-enabled");
276279
}
277280

278-
this.set_applet_label(label_string);
279-
280281
let dateFormattedTooltip = this.clock.get_clock_for_format(DATE_FORMAT_FULL).capitalize();
281282
if (this.use_custom_format) {
282-
dateFormattedTooltip = this.clock.get_clock_for_format(this.custom_tooltip_format).capitalize();
283-
if (!dateFormattedTooltip) {
283+
try {
284+
dateFormattedTooltip = this.clock.get_clock_for_format(this.custom_tooltip_format).capitalize();
285+
} catch (e) {
284286
global.logError("Calendar applet: bad tooltip time format string - check your string.");
285287
dateFormattedTooltip = this.clock.get_clock_for_format("~CLOCK FORMAT ERROR~ %l:%M %p");
286288
}

0 commit comments

Comments
 (0)