From c9b2de2b43d1575a85b5d0344c4a0bd1eb9f93fa Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Fri, 5 May 2023 04:31:30 +0200 Subject: Add missing error handlers --- src/shutdown-dialog.vala | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/shutdown-dialog.vala') diff --git a/src/shutdown-dialog.vala b/src/shutdown-dialog.vala index d0820ee..c30ea0e 100644 --- a/src/shutdown-dialog.vala +++ b/src/shutdown-dialog.vala @@ -2,6 +2,7 @@ * * Copyright (C) 2013 Canonical Ltd * Copyright (C) 2015,2016 Mike Gabriel + * Copyright (C) 2023 Robert Tari * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as @@ -18,6 +19,7 @@ * Authors: Robert Ancell * Marco Trevisan * Mike Gabriel + * Robert Tari */ public enum ShutdownDialogType @@ -100,7 +102,17 @@ public class ShutdownDialog : Gtk.Fixed monitor_events.add (vbox_events); /* Split font family and size via regular expression. */ - Regex font_regexp = new Regex ("^([[:blank:]]*)(?[ a-zA-Z0-9]+) (?[0-9]+)([[:blank:]]*)$"); + Regex font_regexp = null; + + try + { + font_regexp = new Regex ("^([[:blank:]]*)(?[ a-zA-Z0-9]+) (?[0-9]+)([[:blank:]]*)$"); + } + catch (GLib.RegexError pError) + { + error ("Panic: Failed constructing RegEx: %s", pError.message); + } + MatchInfo font_info; if (font_regexp.match(font, 0, out font_info)) { font_family = font_info.fetch_named("font_family"); -- cgit v1.2.3