glib: fix IntPtr.Zero being dereferenced in GLib.Value.ToBoxed()
This commit is contained in:
parent
0d781f485f
commit
cfdbb3b9a7
1 changed files with 4 additions and 0 deletions
|
@ -414,6 +414,10 @@ namespace GLib {
|
||||||
object ToBoxed ()
|
object ToBoxed ()
|
||||||
{
|
{
|
||||||
IntPtr boxed_ptr = g_value_get_boxed (ref this);
|
IntPtr boxed_ptr = g_value_get_boxed (ref this);
|
||||||
|
|
||||||
|
if (boxed_ptr == IntPtr.Zero)
|
||||||
|
return null;
|
||||||
|
|
||||||
Type t = GType.LookupType (type);
|
Type t = GType.LookupType (type);
|
||||||
if (t == null)
|
if (t == null)
|
||||||
throw new Exception ("Unknown type " + new GType (type).ToString ());
|
throw new Exception ("Unknown type " + new GType (type).ToString ());
|
||||||
|
|
Loading…
Reference in a new issue