glib: fix IntPtr.Zero being dereferenced in GLib.Value.ToBoxed()

This commit is contained in:
Stephan Sundermann 2013-11-02 16:52:25 +01:00 committed by Andrés G. Aragoneses
parent 0d781f485f
commit cfdbb3b9a7

View file

@ -414,6 +414,10 @@ namespace GLib {
object ToBoxed ()
{
IntPtr boxed_ptr = g_value_get_boxed (ref this);
if (boxed_ptr == IntPtr.Zero)
return null;
Type t = GType.LookupType (type);
if (t == null)
throw new Exception ("Unknown type " + new GType (type).ToString ());