From d957255ae12b0e5bb1479992c59e2fd83e0460ee Mon Sep 17 00:00:00 2001 From: Maarten Bosmans Date: Fri, 22 May 2009 15:59:15 +0200 Subject: [PATCH] Add check for null before calling Structure.FreeNative --- gstreamer-sharp/Event.custom | 3 ++- gstreamer-sharp/Message.custom | 3 ++- gstreamer-sharp/Query.custom | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gstreamer-sharp/Event.custom b/gstreamer-sharp/Event.custom index dc2f666a25..cdb7dd1dcd 100644 --- a/gstreamer-sharp/Event.custom +++ b/gstreamer-sharp/Event.custom @@ -86,7 +86,8 @@ public Gst.Structure Structure { IntPtr raw_ret = gst_event_get_structure (Handle); Gst.Structure ret = raw_ret == IntPtr.Zero ? null : (Gst.Structure) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Structure), true); - ret.FreeNative = false; + if (ret != null) + ret.FreeNative = false; cached_structure = ret; return ret; } diff --git a/gstreamer-sharp/Message.custom b/gstreamer-sharp/Message.custom index 2d5de621c7..711ca5bc14 100644 --- a/gstreamer-sharp/Message.custom +++ b/gstreamer-sharp/Message.custom @@ -86,7 +86,8 @@ public Gst.Structure Structure { IntPtr raw_ret = gst_message_get_structure (Handle); Gst.Structure ret = raw_ret == IntPtr.Zero ? null : (Gst.Structure) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Structure), true); - ret.FreeNative = false; + if (ret != null) + ret.FreeNative = false; cached_structure = ret; return ret; } diff --git a/gstreamer-sharp/Query.custom b/gstreamer-sharp/Query.custom index c7dda8548a..086118f479 100644 --- a/gstreamer-sharp/Query.custom +++ b/gstreamer-sharp/Query.custom @@ -12,7 +12,8 @@ public Gst.Structure Structure { IntPtr raw_ret = gst_query_get_structure (Handle); Gst.Structure ret = raw_ret == IntPtr.Zero ? null : (Gst.Structure) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Structure), true); - ret.FreeNative = false; + if (ret != null) + ret.FreeNative = false; cached_structure = ret; return ret; }