diff --git a/ChangeLog b/ChangeLog index 3c8737481..d513af38a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-05-12 Mike Kestner + + * glib/Value.cs: explicit exception for unknown props. + [Fixes #502043] Patch by Sebastian Dröge. + 2009-05-12 Mike Kestner * glib/ValueArray.cs: make ctor(IntPtr) public for binding usage. diff --git a/glib/Value.cs b/glib/Value.cs index 6d143f036..297ebfa5c 100755 --- a/glib/Value.cs +++ b/glib/Value.cs @@ -525,8 +525,13 @@ namespace GLib { void InitForProperty (GType gtype, string name) { IntPtr p_name = Marshaller.StringToPtrGStrdup (name); - ParamSpec spec = new ParamSpec (g_object_class_find_property (gtype.ClassPtr, p_name)); + IntPtr spec_ptr = g_object_class_find_property (gtype.ClassPtr, p_name); Marshaller.Free (p_name); + + if (spec_ptr == IntPtr.Zero) + throw new Exception (String.Format ("No property with name '{0}' in type '{1}'", name, gtype.ToString())); + + ParamSpec spec = new ParamSpec (spec_ptr); g_value_init (ref this, spec.ValueType.Val); }