[libgxps] document-structure: Add an assert to ensure node->parent is never NULL



commit c2cdd0f529d7fb375e78494ebd83bd8808331a30
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Sun Jan 29 09:17:41 2017 +0100

    document-structure: Add an assert to ensure node->parent is never NULL
    
    It should never be NULL at that point.

 libgxps/gxps-document-structure.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/libgxps/gxps-document-structure.c b/libgxps/gxps-document-structure.c
index a9bafc3..a2512bb 100644
--- a/libgxps/gxps-document-structure.c
+++ b/libgxps/gxps-document-structure.c
@@ -242,10 +242,12 @@ outline_start_element (GMarkupParseContext  *context,
                        ctx->prevs = g_list_delete_link (ctx->prevs, ctx->prevs);
                }
 
-               if (level == 1)
+               if (level == 1) {
                        ctx->outline = g_list_prepend (ctx->outline, node);
-               else
+                } else {
+                        g_assert (node->parent != NULL);
                        node->parent->children = g_list_prepend (node->parent->children, node);
+                }
 
                ctx->prevs = g_list_prepend (ctx->prevs, node);
                ctx->level = level;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]