summaryrefslogtreecommitdiff
path: root/gtk/gtkbuilderparser.c
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2007-06-27 00:37:50 +0000
committerJohan Dahlin <johan@src.gnome.org>2007-06-27 00:37:50 +0000
commitae800a34fa31f83feca666c0684d867409df109f (patch)
treec30a5eab9930ec81c155841858c90e53d5c900ed /gtk/gtkbuilderparser.c
parent1d2955bcafb23d56c55e515cdc078ca3152e2446 (diff)
downloadgtk+-ae800a34fa31f83feca666c0684d867409df109f.tar.gz
Set an error if we encounter properties without values set (#451303,
* gtk/gtkbuilder.h (enum): * gtk/gtkbuilderparser.c (end_element): * tests/buildertest.c (test_parser): Set an error if we encounter properties without values set (#451303, Philip Withnall) svn path=/trunk/; revision=18252
Diffstat (limited to 'gtk/gtkbuilderparser.c')
-rw-r--r--gtk/gtkbuilderparser.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gtk/gtkbuilderparser.c b/gtk/gtkbuilderparser.c
index 25b3479946..ea2df67e64 100644
--- a/gtk/gtkbuilderparser.c
+++ b/gtk/gtkbuilderparser.c
@@ -139,6 +139,24 @@ error_invalid_tag (ParserData *data,
line_number, char_number, tag);
}
+static void
+error_missing_property_value (ParserData *data,
+ GError **error)
+{
+ gint line_number, char_number;
+
+ g_markup_parse_context_get_position (data->ctx,
+ &line_number,
+ &char_number);
+
+ g_set_error (error,
+ GTK_BUILDER_ERROR,
+ GTK_BUILDER_ERROR_MISSING_PROPERTY_VALUE,
+ "%s:%d:%d <property> must have a value set",
+ data->filename,
+ line_number, char_number);
+}
+
static GObject *
builder_construct (ParserData *data,
ObjectInfo *object_info)
@@ -707,6 +725,12 @@ end_element (GMarkupParseContext *context,
PropertyInfo *prop_info = state_pop_info (data, PropertyInfo);
CommonInfo *info = state_peek_info (data, CommonInfo);
+ if (!prop_info->data)
+ {
+ error_missing_property_value (data, error);
+ return;
+ }
+
/* Normal properties */
if (strcmp (info->tag.name, "object") == 0)
{