mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-01 03:52:25 +00:00
Gst.Object: add some pre-validation to property setter
This commit is contained in:
parent
2bd2b1d7af
commit
6b297b921f
1 changed files with 8 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue