aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Lefebvre <clement.lefebvre@linuxmint.com>2017-06-20 15:36:01 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-06-20 15:36:01 +0200
commit89876fc7d6922995d6c253a222a608153772227d (patch)
treecd5ce48a8677f02824c8b789df5e9b2d3ad8f085
parentb37ceae7c7a8dbbaa76c74a7720f9d77b2aebcd9 (diff)
downloadarctica-greeter-89876fc7d6922995d6c253a222a608153772227d.tar.gz
arctica-greeter-89876fc7d6922995d6c253a222a608153772227d.tar.bz2
arctica-greeter-89876fc7d6922995d6c253a222a608153772227d.zip
src/background.vala: No runtime warning on empty background image filename. Ported from slick-greeter.
-rw-r--r--src/background.vala18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/background.vala b/src/background.vala
index 967e9f9..0c722e8 100644
--- a/src/background.vala
+++ b/src/background.vala
@@ -439,14 +439,16 @@ public class Background : Gtk.Fixed
width = height = 0;
try
{
- var image = new Gdk.Pixbuf.from_file (filename);
- width = image.width;
- height = image.height;
- var surface = new Cairo.Surface.similar (target_surface, Cairo.Content.COLOR_ALPHA, image.width, image.height);
- var c = new Cairo.Context (surface);
- Gdk.cairo_set_source_pixbuf (c, image, 0, 0);
- c.paint ();
- return surface;
+ if (filename != "") {
+ var image = new Gdk.Pixbuf.from_file (filename);
+ width = image.width;
+ height = image.height;
+ var surface = new Cairo.Surface.similar (target_surface, Cairo.Content.COLOR_ALPHA, image.width, image.height);
+ var c = new Cairo.Context (surface);
+ Gdk.cairo_set_source_pixbuf (c, image, 0, 0);
+ c.paint ();
+ return surface;
+ }
}
catch (Error e)
{