diff options
author | dequis <dx@dxzone.com.ar> | 2015-12-20 05:58:55 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2015-12-20 15:29:38 -0300 |
commit | 72e2a0eb4cf6a3bfd6464ebf2d03cc83647568bd (patch) | |
tree | c3d3108ef63502d64fb8171e625780628f93c8b8 /facebook/facebook-json.c | |
parent | 0121bae03b6d545ff799f4b02c9b05becac1b78b (diff) | |
download | bitlbee-facebook-72e2a0eb4cf6a3bfd6464ebf2d03cc83647568bd.tar.gz bitlbee-facebook-72e2a0eb4cf6a3bfd6464ebf2d03cc83647568bd.tar.bz2 bitlbee-facebook-72e2a0eb4cf6a3bfd6464ebf2d03cc83647568bd.tar.xz |
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)
Diffstat (limited to 'facebook/facebook-json.c')
-rw-r--r-- | facebook/facebook-json.c | 5 |
1 files changed, 5 insertions, 0 deletions
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) { |