From b829ad1507bde6c1abddf8e9519ae941e0d63612 Mon Sep 17 00:00:00 2001 From: johanengelen Date: Wed, 25 Jun 2008 19:50:01 +0000 Subject: [PATCH] help detection of path read bug --- src/svg/svg-path.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/svg/svg-path.cpp b/src/svg/svg-path.cpp index 24ce3c15c..353bb1da3 100644 --- a/src/svg/svg-path.cpp +++ b/src/svg/svg-path.cpp @@ -43,6 +43,7 @@ #include <2geom/sbasis-to-bezier.h> #include <2geom/svg-path.h> #include <2geom/svg-path-parser.h> +#include <2geom/exception.h> /* This module parses an SVG path element into an RsvgBpathDef. @@ -676,14 +677,18 @@ NArtBpath *sp_svg_read_path(gchar const *str) Geom::PathVector sp_svg_read_pathv(char const * str) { std::vector pathv; + if (!str) + return pathv; // return empty pathvector when str == NULL - // TODO: enable this exception catching. don't catch now to better see when things go wrong -// try { + try { pathv = Geom::parse_svg_path(str); -// } -// catch (std::runtime_error e) { -// g_warning("SVGPathParseError: %s", e.what()); -// } + } + catch (Geom::SVGPathParseError e) { + g_warning("SVGPathParseError: %s", e.what()); + g_warning("svgd str: %s", str); + throw Geom::SVGPathParseError(); // rethrow, maybe not necessary, can instead return empty path? + return std::vector(); + } return pathv; } -- 2.30.2