EionRobb / pidgin-opensteamworks

Steam plugin for Pidgin/libpurple
153 stars 5 forks source link

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

Open mxmlnkn opened 8 years ago

mxmlnkn commented 8 years ago

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?

EionRobb commented 8 years ago

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 :)

saironiq commented 8 years ago

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.

Xylemon commented 8 years ago

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

EionRobb commented 8 years ago

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...

tripplet commented 8 years ago

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)
EionRobb commented 8 years ago

@tripplet Thanks for the good news :)