From b7ecfdde15624a165ffa73220f0fd3e95ad27873 Mon Sep 17 00:00:00 2001 From: Amit Dhingra Date: Sun, 23 Dec 2012 21:45:49 -0600 Subject: [PATCH] hid/png: Error out when layout contains no data. When the layout file does not contain any data, exporting to png via command line segfaults since bounding box cannot be determined and returns NULL. This patch checks for bounding box and prints an error if no data is found. Affects-bug: lp-1048256 Signed-off-by: Amit Dhingra --- src/hid/png/png.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/hid/png/png.c b/src/hid/png/png.c index 2b27740..21df4c2 100644 --- a/src/hid/png/png.c +++ b/src/hid/png/png.c @@ -839,6 +839,12 @@ png_do_export (HID_Attr_Val * options) if (options[HA_only_visible].int_value) { bbox = GetDataBoundingBox (PCB->Data); + if (bbox == NULL) + { + fprintf (stderr, "ERROR: Unable to determine bounding box limits\n"); + fprintf (stderr, "ERROR: Does the file contain any data?\n"); + return; + } x_shift = bbox->X1; y_shift = bbox->Y1; h = bbox->Y2 - bbox->Y1; -- 1.7.10.4