From 72e2a0eb4cf6a3bfd6464ebf2d03cc83647568bd Mon Sep 17 00:00:00 2001 From: dequis Date: Sun, 20 Dec 2015 05:58:55 -0300 Subject: facebook-json:`Special-case "$" to return root for json-glib < 0.99.2 Older glib versions didn't consider "$" to be a valid expression, and threw this error: Root node followed by invalid character ' (That's supposed to be '%c' with a \0) Since this is possibly the simplest expression to parse, a g_strcmp0() can do the job. Thanks to advcomp2019 for reporting this bug and finding a test case where this issue is reproducible every time (receiving events of people joining or leaving in a groupchat) Also thanks to EionRobb who realized what the bug was three hours ago (and I didn't listen because I thought the previous bug was the same) --- facebook/facebook-json.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/facebook/facebook-json.c b/facebook/facebook-json.c index 83332b4..9176f03 100644 --- a/facebook/facebook-json.c +++ b/facebook/facebook-json.c @@ -284,6 +284,11 @@ fb_json_node_get(JsonNode *root, const gchar *expr, GError **error) JsonNode *node; JsonNode *ret; + /* Special case for json-glib < 0.99.2 */ + if (g_strcmp0(expr, "$") == 0) { + return json_node_copy(root); + } + node = json_path_query(expr, root, &err); if (err != NULL) { -- cgit v1.2.3