pidgin-opensteamworks icon indicating copy to clipboard operation
pidgin-opensteamworks copied to clipboard

Json-CRITICAL **: json_object_get_int_member: assertion 'node != NULL' failed

Open mxmlnkn opened this issue 9 years ago • 6 comments

I'm using release 1.6.1 64bit.

The plugin itself works without problems so far, but my ~/.xsession-errors gets spammed with the error message from the title every 20 seconds. Is there some way to solve that error?

mxmlnkn avatar Feb 07 '16 16:02 mxmlnkn

You could try setting the G_DEBUG environment variable to hide them?

The 'error' occurs when we're requesting the member of a JSON object but it doesn't exist which happens in sometimes, eg if we're trying to get the name of the game the other user is playing but they're not currently in a game, you'd get that message. Not as critical as the message makes it out to be though :)

EionRobb avatar Feb 25 '16 07:02 EionRobb

that should never happen if you're wrapping each get in json_object_has_member(), see: https://developer.gnome.org/json-glib/stable/json-glib-JSON-Object.html#json-object-has-member

it's not json-glib's error.

saironiq avatar Apr 08 '16 00:04 saironiq

So does that mean this annoying and constant error in the terminal is fixable?

Xylemon avatar Apr 08 '16 01:04 Xylemon

We could make a wrapper function that does the "has member" check before the "get member" call?

I wonder if it's also possible to override the current calls with a #define to do the same with fewer lines-of-code changes...

EionRobb avatar Apr 08 '16 07:04 EionRobb

The following preprocessor macro seems to work for get_int_member But if only masks the error, relying on zero as default value and expecting the the calling code works properly if zero is returned for a non existing member.

#define json_object_get_int_member(JSON_OBJECT, MEMBER) (json_object_has_member(JSON_OBJECT, MEMBER) ? json_object_get_int_member(JSON_OBJECT, MEMBER) : 0)

tripplet avatar Apr 15 '16 21:04 tripplet

@tripplet Thanks for the good news :)

EionRobb avatar Apr 15 '16 22:04 EionRobb