[template-glib: 1/2] Throw error for null {{include}} path



commit a69302d4bf09ec4978c6c8993f91de6f515b5547
Author: Zander Brown <ajhb2001 outlook com>
Date:   Sat May 5 18:45:40 2018 +0100

    Throw error for null {{include}} path
    
    Previous assert would crash the process

 src/tmpl-lexer.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/tmpl-lexer.c b/src/tmpl-lexer.c
index edfeea5..2997463 100644
--- a/src/tmpl-lexer.c
+++ b/src/tmpl-lexer.c
@@ -143,7 +143,15 @@ tmpl_lexer_next (TmplLexer     *self,
           GInputStream *input;
 
           g_assert (self->circular != NULL);
-          g_assert (path != NULL);
+
+          if (path == NULL)
+            {
+              local_error = g_error_new (TMPL_ERROR,
+                                         TMPL_ERROR_NOT_A_VALUE,
+                                         "Expected template path, got null");
+              g_clear_pointer (token, tmpl_token_free);
+              TMPL_GOTO (finish);
+            }
 
           if (g_hash_table_contains (self->circular, path))
             {


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