SVG parse_svg_value/parse_font_size: re-initialise default val on parser failure
This commit is contained in:
parent
4ff25eb2a8
commit
3031b7cf6a
1 changed files with 14 additions and 12 deletions
|
@ -268,15 +268,16 @@ double parse_svg_value(T & parser, char const* str, bool & is_percent)
|
|||
x3::space) || (cur != end))
|
||||
{
|
||||
parser.err_handler().on_error("SVG parse error: failed to parse <number> with value \"" + std::string(str) + "\"");
|
||||
val = 0.0; // re-initialise to default value
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
double parse_font_size(T & parser, char const* str)
|
||||
bool parse_font_size(T & parser, char const* str)
|
||||
{
|
||||
namespace x3 = boost::spirit::x3;
|
||||
double val;
|
||||
double val = 0.0;
|
||||
css_unit_value units;
|
||||
css_absolute_size absolute;
|
||||
css_relative_size relative;
|
||||
|
@ -303,9 +304,10 @@ double parse_font_size(T & parser, char const* str)
|
|||
x3::space) || (cur != end))
|
||||
{
|
||||
parser.err_handler().on_error("SVG parse error: failed to parse <font-size> with value \"" + std::string(str) + "\"");
|
||||
return false;
|
||||
}
|
||||
if (!parser.font_sizes_.empty()) parser.font_sizes_.back() = val;
|
||||
return val;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T, typename V>
|
||||
|
|
Loading…
Reference in a new issue