Gst.Object: add some pre-validation to property setter
This commit is contained in:
parent
2bd2b1d7af
commit
6b297b921f
@ -53,6 +53,14 @@ namespace Gst {
|
|||||||
throw new PropertyNotFoundException ();
|
throw new PropertyNotFoundException ();
|
||||||
} set {
|
} set {
|
||||||
if (PropertyExists (property)) {
|
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 ())) {
|
using (GLib.Value v = new GLib.Value ((GLib.GType)value.GetType ())) {
|
||||||
v.Val = value;
|
v.Val = value;
|
||||||
SetProperty (property, v);
|
SetProperty (property, v);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user