diff options
author | Thomas White <taw@physics.org> | 2018-03-11 11:19:36 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2018-03-11 11:19:36 +0100 |
commit | 9c445ade639c64c6d916904c79488b7ff8434329 (patch) | |
tree | 33031b23c7fae73996c4ffe5d108010d9158d3ec /src/sc_editor.c | |
parent | 943ee7396bad49a9df5ecd7d03c35f453ba230cd (diff) |
Fail cleanly if background pixbuf can't be loaded
Diffstat (limited to 'src/sc_editor.c')
-rw-r--r-- | src/sc_editor.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/sc_editor.c b/src/sc_editor.c index c110b1a..cec0186 100644 --- a/src/sc_editor.c +++ b/src/sc_editor.c @@ -659,10 +659,15 @@ static void draw_overlay(cairo_t *cr, SCEditor *e) static gboolean draw_sig(GtkWidget *da, cairo_t *cr, SCEditor *e) { /* Ultimate background */ - gdk_cairo_set_source_pixbuf(cr, e->bg_pixbuf, 0.0, 0.0); - cairo_pattern_t *patt = cairo_get_source(cr); - cairo_pattern_set_extend(patt, CAIRO_EXTEND_REPEAT); - cairo_paint(cr); + if ( e->bg_pixbuf != NULL ) { + gdk_cairo_set_source_pixbuf(cr, e->bg_pixbuf, 0.0, 0.0); + cairo_pattern_t *patt = cairo_get_source(cr); + cairo_pattern_set_extend(patt, CAIRO_EXTEND_REPEAT); + cairo_paint(cr); + } else { + cairo_set_source_rgba(cr, 0.8, 0.8, 1.0, 1.0); + cairo_paint(cr); + } cairo_translate(cr, e->border_offs_x, e->border_offs_y); cairo_translate(cr, -e->h_scroll_pos, -e->scroll_pos); |