From 6b297b921f9aafe2f1b5583f483fbd51c720883a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20G=2E=20Aragoneses?= Date: Sat, 12 Oct 2013 19:10:32 +0200 Subject: [PATCH] Gst.Object: add some pre-validation to property setter --- sources/custom/Object.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sources/custom/Object.cs b/sources/custom/Object.cs index 283d41bfec..97a37ddbaa 100644 --- a/sources/custom/Object.cs +++ b/sources/custom/Object.cs @@ -53,6 +53,14 @@ namespace Gst { throw new PropertyNotFoundException (); } set { if (PropertyExists (property)) { + if (value == null) { + throw new ArgumentNullException (); + } + var type = value.GetType (); + var gtype = (GLib.GType)type; + if (gtype == null) { + throw new Exception ("Could not find a GType for type " + type.FullName); + } using (GLib.Value v = new GLib.Value ((GLib.GType)value.GetType ())) { v.Val = value; SetProperty (property, v);