[gegl] gegl-xml: check class variable earlier to avoid segfault
- From: Michael Murà <mmure src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] gegl-xml: check class variable earlier to avoid segfault
- Date: Sun, 4 Sep 2011 17:37:12 +0000 (UTC)
commit 17ffbb9e4f1cbd876bdad3624d1d2683dfd1c0ed
Author: Michael Murà <batolettre gmail com>
Date: Sun Sep 4 13:00:05 2011 +0200
gegl-xml: check class variable earlier to avoid segfault
gegl/gegl-xml.c | 84 +++++++++++++++++++++++++++---------------------------
1 files changed, 42 insertions(+), 42 deletions(-)
---
diff --git a/gegl/gegl-xml.c b/gegl/gegl-xml.c
index 9358cce..25301db 100644
--- a/gegl/gegl-xml.c
+++ b/gegl/gegl-xml.c
@@ -982,53 +982,53 @@ add_stack (SerializeState *ss,
}
}
- if (!strcmp (class, "layer"))
+ if (class)
{
- serialize_layer (ss, indent, iter);
- }
- else
- {
- if (aux &&
- gegl_pad_get_connected_to (aux))
+ if (!strcmp (class, "layer"))
{
- GeglPad *source_pad;
- GeglNode *source_node;
- source_pad = gegl_pad_get_connected_to (aux);
- source_node = gegl_pad_get_node (source_pad);
- {
- GeglNode *graph = g_object_get_data (G_OBJECT (source_node),
- "graph");
- if (graph)
- source_node = graph;
- }
- ind; g_string_append (ss->buf, "<node");
-
- {
- gchar *class;
- gchar *name;
- gegl_node_get (iter, "operation", &class,
- "name", &name,
- NULL);
- if (name[0])
- {
- xml_attr (ss->buf, "name", name);
- }
- xml_attr (ss->buf, "operation", class);
- if (id != NULL)
- xml_attr (ss->buf, "id", id);
- g_free (name);
- g_free (class);
- }
-
- g_string_append (ss->buf, ">\n");
- serialize_properties (ss, indent + 4, iter);
- add_stack (ss, indent + 4, source_node);
-
- ind; g_string_append (ss->buf, "</node>\n");
+ serialize_layer (ss, indent, iter);
}
else
{
- if (class)
+ if (aux &&
+ gegl_pad_get_connected_to (aux))
+ {
+ GeglPad *source_pad;
+ GeglNode *source_node;
+ source_pad = gegl_pad_get_connected_to (aux);
+ source_node = gegl_pad_get_node (source_pad);
+ {
+ GeglNode *graph = g_object_get_data (G_OBJECT (source_node),
+ "graph");
+ if (graph)
+ source_node = graph;
+ }
+ ind; g_string_append (ss->buf, "<node");
+
+ {
+ gchar *class;
+ gchar *name;
+ gegl_node_get (iter, "operation", &class,
+ "name", &name,
+ NULL);
+ if (name[0])
+ {
+ xml_attr (ss->buf, "name", name);
+ }
+ xml_attr (ss->buf, "operation", class);
+ if (id != NULL)
+ xml_attr (ss->buf, "id", id);
+ g_free (name);
+ g_free (class);
+ }
+
+ g_string_append (ss->buf, ">\n");
+ serialize_properties (ss, indent + 4, iter);
+ add_stack (ss, indent + 4, source_node);
+
+ ind; g_string_append (ss->buf, "</node>\n");
+ }
+ else
{
if (strcmp (class, "gegl:nop") &&
strcmp (class, "gegl:clone"))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]