Gst.Object: add some pre-validation to property setter

This commit is contained in:
Andrés G. Aragoneses 2013-10-12 19:10:32 +02:00 committed by Stephan Sundermann
parent 2bd2b1d7af
commit 6b297b921f

View file

@ -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);