[gnome-usage] storage-actionbar: Null-check a variable before using it
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-usage] storage-actionbar: Null-check a variable before using it
- Date: Fri, 3 Dec 2021 11:39:16 +0000 (UTC)
commit 5cdc102cfb35d52055ca6640ef9b0b62b3991865
Author: Adrien Plazas <kekun plazas laposte net>
Date: Fri Dec 3 12:28:42 2021 +0100
storage-actionbar: Null-check a variable before using it
This avoids a compilation warning.
src/storage/storage-actionbar.vala | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/storage/storage-actionbar.vala b/src/storage/storage-actionbar.vala
index 93a0da8..d471323 100644
--- a/src/storage/storage-actionbar.vala
+++ b/src/storage/storage-actionbar.vala
@@ -40,9 +40,13 @@ namespace Usage {
[GtkCallback]
private void delete_clicked() {
+ var application = GLib.Application.get_default() as Application;
string display_message = _("Are you sure you want to permanently delete selected items?");
- var dialog = new Gtk.MessageDialog ((GLib.Application.get_default() as
Application).get_window(), Gtk.DialogFlags.MODAL,
+ if (application == null)
+ return;
+
+ var dialog = new Gtk.MessageDialog (application.get_window(), Gtk.DialogFlags.MODAL,
Gtk.MessageType.WARNING, Gtk.ButtonsType.OK_CANCEL, display_message);
dialog.secondary_text = _("If you delete these items, they will be permanently lost.");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]