From a56640c647ad2fc3a53b9ae8b4f02149257b1f54 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 13 Mar 2012 16:41:41 +0100 Subject: Protect against missing attributes and property files. (bzr r11078) --- src/attribute-rel-svg.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/attribute-rel-svg.cpp') diff --git a/src/attribute-rel-svg.cpp b/src/attribute-rel-svg.cpp index 3f5ce9395..80d924f80 100644 --- a/src/attribute-rel-svg.cpp +++ b/src/attribute-rel-svg.cpp @@ -26,6 +26,7 @@ #include "preferences.h" SPAttributeRelSVG * SPAttributeRelSVG::instance = NULL; +bool SPAttributeRelSVG::foundFile = false; /* * This functions checks whether an element -> attribute pair is allowed or not @@ -36,6 +37,9 @@ bool SPAttributeRelSVG::findIfValid(Glib::ustring attribute, Glib::ustring eleme SPAttributeRelSVG::instance = new SPAttributeRelSVG(); } + // Always valid if data file not found! + if( !foundFile ) return true; + // Strip of "svg:" from the element's name Glib::ustring temp = element; if ( temp.find("svg:") != std::string::npos ) { @@ -75,16 +79,14 @@ SPAttributeRelSVG::SPAttributeRelSVG() f.open(filepath.c_str(), std::ios::in); if (!f.is_open()) { - // Set the default preference of attribute checking to ignore - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setInt("/options/svgoutput/incorrect_attributes", 3); - // Display warning for file not open g_warning("Could not open the data file for XML attribute-element map construction: %s", filepath.c_str()); f.close(); return ; } + foundFile = true; + while (!f.eof()){ std::stringstream ss; std::string s; -- cgit v1.2.3