From 394b186a901853a7c3b52a4b6ff405db3b537cf6 Mon Sep 17 00:00:00 2001 From: joncruz Date: Sun, 14 Sep 2008 04:59:18 +0000 Subject: [PATCH] Handle optional bbox behavior. Fixes warning. --- src/main.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index da1d812c3..ba9ffde6a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1177,7 +1177,14 @@ sp_do_export_png(SPDocument *doc) // write object bbox to area sp_document_ensure_up_to_date (doc); - sp_item_invoke_bbox((SPItem *) o_area, &area, sp_item_i2r_affine((SPItem *) o_area), TRUE); + boost::optional areaMaybe; + sp_item_invoke_bbox((SPItem *) o_area, areaMaybe, sp_item_i2r_affine((SPItem *) o_area), TRUE); + if (areaMaybe) { + area = NRRect(areaMaybe); + } else { + g_warning("Unable to determine a valid bounding box. Nothing exported."); + return; + } } else { g_warning("Object with id=\"%s\" was not found in the document. Nothing exported.", sp_export_id); return; @@ -1229,8 +1236,9 @@ sp_do_export_png(SPDocument *doc) } // default dpi - if (dpi == 0.0) + if (dpi == 0.0) { dpi = PX_PER_IN; + } unsigned long int width = 0; unsigned long int height = 0; -- 2.30.2