Handle 0-valued GType gracefully
Zero is a valid return value for GLib's type_from_name() in case the type in question is not registered. It needs to be handled gracefully.
$ ./gjs-console -c 'print (imports.gi.GObject.type_from_name ("Nonexistent"))'
(lt-gjs-console:18975): GLib-GObject-CRITICAL **: g_type_get_qdata: assertion 'node != NULL' failed
(lt-gjs-console:18975): GLib-GObject-CRITICAL **: g_type_set_qdata: assertion 'node != NULL' failed
[object GType prototype]
(lt-gjs-console:18975): GLib-GObject-CRITICAL **: g_type_get_qdata: assertion 'node != NULL' failed
Segmentation fault (core dumped)
$
This is a bit of a pity, because we can't use this to check whether a particular module has been loaded.
I'm wondering if you by chance know of a good good way for a GNOME Extension to tell whether it's running on an old GNOME Shell (with old gjs) that has loaded libnm-glib.so?
Edited by Philip Chimento