[json-glib] Handle invalid path: invalid first character



commit d82420c14b19f29a993b7754ff1128b3524c4ad7
Author: bi <bisnard antidot net>
Date:   Wed May 15 17:35:26 2013 +0200

    Handle invalid path: invalid first character
    
    Signed-off-by: Emmanuele Bassi <ebassi gnome org>
    
    Conflicts:
        json-glib/json-path.c

 json-glib/json-path.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/json-glib/json-path.c b/json-glib/json-path.c
index e59a285..f829433 100644
--- a/json-glib/json-path.c
+++ b/json-glib/json-path.c
@@ -417,7 +417,7 @@ json_path_compile (JsonPath    *path,
 {
   const char *p, *end_p;
   PathNode *root = NULL;
-  GList *nodes;
+  GList *nodes = NULL;
 
   g_return_val_if_fail (expression != NULL, FALSE);
 
@@ -698,6 +698,14 @@ json_path_compile (JsonPath    *path,
           break;
 
         default:
+          if (nodes == NULL)
+            {
+              g_set_error(error, JSON_PATH_ERROR,
+                          JSON_PATH_ERROR_INVALID_QUERY,
+                          _("Invalid first character '%c'"),
+                          *p);
+              return FALSE;
+            }
           break;
         }
 


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