[gnome-usage] window: Null-check a variable before using it
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-usage] window: Null-check a variable before using it
- Date: Fri, 3 Dec 2021 11:39:16 +0000 (UTC)
commit 37f467f57b3bcc92297613311bcf741b753ce8ab
Author: Adrien Plazas <kekun plazas laposte net>
Date: Fri Dec 3 11:53:15 2021 +0100
window: Null-check a variable before using it
This avoids a compilation warning.
src/window.vala | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/window.vala b/src/window.vala
index f565d40..6fb1211 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -121,8 +121,13 @@ namespace Usage {
[GtkCallback]
private void on_performance_search_button_toggled () {
+ var application = GLib.Application.get_default() as Application;
+
+ if (application == null)
+ return;
+
/* TODO: Implement a saner way of toggling this mode. */
- ((PerformanceView) (GLib.Application.get_default() as
Application).get_window().get_views()[Views.PERFORMANCE]).set_search_mode(performance_search_button.active);
+ ((PerformanceView)
application.get_window().get_views()[Views.PERFORMANCE]).set_search_mode(performance_search_button.active);
}
[GtkCallback]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]