From 46e1cbd0df78d3f02511c754a478ce58e9f3d2e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Mon, 16 Jun 2025 10:45:45 +0200 Subject: [PATCH] StyleManager: Allow the GLib.Application to be null This is for instance the case for the portal application. --- lib/StyleManager.vala | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/StyleManager.vala b/lib/StyleManager.vala index 850bd1c42..5a0ac551c 100644 --- a/lib/StyleManager.vala +++ b/lib/StyleManager.vala @@ -79,12 +79,15 @@ public class Granite.StyleManager : Object { private void set_provider_for_display () { if (app_provider == null) { - var base_path = Application.get_default ().resource_base_path; - if (base_path != null) { - var base_uri = "resource://" + base_path; - var base_file = File.new_for_uri (base_uri); - - app_provider = init_provider_from_file (base_file.get_child ("Application.css")); + unowned GLib.Application? app = Application.get_default (); + if (app != null) { + var base_path = app.resource_base_path; + if (base_path != null) { + var base_uri = "resource://" + base_path; + var base_file = File.new_for_uri (base_uri); + + app_provider = init_provider_from_file (base_file.get_child ("Application.css")); + } } if (app_provider != null) {