From 80f77282264afb1356351024b1f062b2824bba3b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 25 Sep 2014 17:59:46 +0300 Subject: [PATCH] [util] Fix ansi output when surface is empty --- util/helper-cairo-ansi.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/helper-cairo-ansi.cc b/util/helper-cairo-ansi.cc index 376bf2b83..50f9eb446 100644 --- a/util/helper-cairo-ansi.cc +++ b/util/helper-cairo-ansi.cc @@ -63,10 +63,10 @@ helper_cairo_surface_write_to_ansi_stream (cairo_surface_t *surface, * Find the tight image top/bottom and only print in between. */ /* Use corner color as background color. */ - uint32_t bg_color = * (uint32_t *) data; + uint32_t bg_color = data ? * (uint32_t *) data : 0; /* Drop first row while empty */ - while (height) + while (height) { unsigned int i; for (i = 0; i < width; i++)