diff options
| author | Jabiertxof <jabier.arraiza@marker.es> | 2019-08-27 21:05:08 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-08-28 15:09:41 +0000 |
| commit | 24d4880042773a9edd32565ab7d2388d930a13da (patch) | |
| tree | 7a0c20f7a17eb56e97f1981e53a35a9b95cef91f /src/object/sp-style-elem.cpp | |
| parent | Puts back translator comments (diff) | |
| download | inkscape-24d4880042773a9edd32565ab7d2388d930a13da.tar.gz inkscape-24d4880042773a9edd32565ab7d2388d930a13da.zip | |
Fix issues pointed by @ede123 and cssinate
Diffstat (limited to 'src/object/sp-style-elem.cpp')
| -rw-r--r-- | src/object/sp-style-elem.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/object/sp-style-elem.cpp b/src/object/sp-style-elem.cpp index 3b93ff190..a8897fa44 100644 --- a/src/object/sp-style-elem.cpp +++ b/src/object/sp-style-elem.cpp @@ -468,6 +468,9 @@ void SPStyleElem::read_content() { //XML Tree being used directly here while it shouldn't be. Glib::ustring const text = concat_children(*getRepr()); + if (!(text.find_first_not_of(" \t\r\n") != std::string::npos)) { + return; + } CRStatus const parse_status = cr_parser_parse_buf (parser, reinterpret_cast<const guchar *>(text.c_str()), text.bytes(), CR_UTF_8); @@ -491,10 +494,11 @@ void SPStyleElem::read_content() { cr_parser_destroy(parser); delete parse_tmp; - - //Record each css statement as an SPStyle - gint count = cr_stylesheet_nr_rules(style_sheet); - + gint count = 0; + if (style_sheet) { + // Record each css statement as an SPStyle + count = cr_stylesheet_nr_rules(style_sheet); + } // Clean out any previous styles for (auto& style:styles) sp_style_unref(style); @@ -506,7 +510,6 @@ void SPStyleElem::read_content() { item->mergeStatement(statement); styles.push_back(item); } - // If style sheet has changed, we need to cascade the entire object tree, top down // Get root, read style, loop through children update_style_recursively( (SPObject *)document->getRoot() ); |
