Skip to content

Commit 66c5fec

Browse files
authored
StyleManager: Allow the GLib.Application to be null (#876)
1 parent b76b402 commit 66c5fec

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

lib/StyleManager.vala

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,15 @@ public class Granite.StyleManager : Object {
7979

8080
private void set_provider_for_display () {
8181
if (app_provider == null) {
82-
var base_path = Application.get_default ().resource_base_path;
83-
if (base_path != null) {
84-
var base_uri = "resource://" + base_path;
85-
var base_file = File.new_for_uri (base_uri);
86-
87-
app_provider = init_provider_from_file (base_file.get_child ("Application.css"));
82+
unowned GLib.Application? app = Application.get_default ();
83+
if (app != null) {
84+
var base_path = app.resource_base_path;
85+
if (base_path != null) {
86+
var base_uri = "resource://" + base_path;
87+
var base_file = File.new_for_uri (base_uri);
88+
89+
app_provider = init_provider_from_file (base_file.get_child ("Application.css"));
90+
}
8891
}
8992

9093
if (app_provider != null) {

0 commit comments

Comments
 (0)