From 4ecb7f9d77f45f7eaaca0465d2f549efef766e77 Mon Sep 17 00:00:00 2001 From: Bryce Harrington Date: Sat, 21 Sep 2013 19:46:12 -0700 Subject: units: Catch FileError if no units.xml is in /usr/local/... Reproducible by building and running inkscape in-tree, without installation. #10 0x0000000000aa6873 in Inkscape::Util::UnitTable::UnitTable (this=0x11f75e0) at util/units.cpp:195 filename = 0x121e8f0 "/usr/local/share/inkscape/ui/units.xml" (bzr r12571) --- src/util/units.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util/units.cpp b/src/util/units.cpp index e5c6f74fb..59717d0b5 100644 --- a/src/util/units.cpp +++ b/src/util/units.cpp @@ -321,6 +321,9 @@ bool UnitTable::load(std::string const &filename) { Glib::ustring unitfile = Glib::file_get_contents(filename); ctx.parse(unitfile); ctx.end_parse(); + } catch (Glib::FileError const &e) { + g_warning("Units file %s is missing: %s\n", filename.c_str(), e.what().c_str()); + return false; } catch (Glib::MarkupError const &e) { g_warning("Problem loading units file '%s': %s\n", filename.c_str(), e.what().c_str()); return false; -- cgit v1.2.3