summaryrefslogtreecommitdiff
path: root/gtk/gtkcsspositionvalue.c
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2012-05-11 20:46:18 -0400
committerCosimo Cecchi <cosimoc@gnome.org>2012-05-15 13:24:40 -0400
commit3cd6edeba849024c55c6ecff6b0c7c58587294de (patch)
treec1a0f494f55f60300f84227d00191bccf1484b74 /gtk/gtkcsspositionvalue.c
parenta17c69cc037c3b4e1e298b2fdae9071fdc31ce06 (diff)
downloadgtk+-3cd6edeba849024c55c6ecff6b0c7c58587294de.tar.gz
csspositionvalue: make empty error value non fatal
If there's just no value to parse (e.g. because we're parsing a shorthand property), don't error out while trying to parse a number.
Diffstat (limited to 'gtk/gtkcsspositionvalue.c')
-rw-r--r--gtk/gtkcsspositionvalue.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/gtk/gtkcsspositionvalue.c b/gtk/gtkcsspositionvalue.c
index 61c34f3162..fd230ed917 100644
--- a/gtk/gtkcsspositionvalue.c
+++ b/gtk/gtkcsspositionvalue.c
@@ -187,12 +187,18 @@ _gtk_css_position_value_parse (GtkCssParser *parser)
}
if (names[first].name == NULL)
{
- missing = &y;
- x = _gtk_css_number_value_parse (parser,
- GTK_CSS_PARSE_PERCENT
- | GTK_CSS_PARSE_LENGTH);
- if (x == NULL)
- return NULL;
+ if (_gtk_css_parser_has_number (parser))
+ {
+ missing = &y;
+ x = _gtk_css_number_value_parse (parser,
+ GTK_CSS_PARSE_PERCENT
+ | GTK_CSS_PARSE_LENGTH);
+
+ if (x == NULL)
+ return NULL;
+ }
+ else
+ return NULL;
}
for (second = 0; names[second].name != NULL; second++)