Handle NULL GstIterator* correctly

This commit is contained in:
Sebastian Dröge 2009-05-01 17:05:49 +02:00
parent 3f74ddbae3
commit 3c4bf5f4e3

View file

@ -54,6 +54,9 @@ private class PadEnumerable : IEnumerable {
IntPtr raw_ret; IntPtr raw_ret;
bool retry = false; bool retry = false;
if (iterator == IntPtr.Zero)
return false;
do { do {
int ret = gst_iterator_next (iterator, out raw_ret); int ret = gst_iterator_next (iterator, out raw_ret);
switch (ret) { switch (ret) {
@ -82,7 +85,8 @@ private class PadEnumerable : IEnumerable {
public void Reset () { public void Reset () {
seen.Clear (); seen.Clear ();
gst_iterator_resync (iterator); if (iterator != IntPtr.Zero)
gst_iterator_resync (iterator);
} }
public PadEnumerator (IntPtr iterator) { public PadEnumerator (IntPtr iterator) {
@ -103,7 +107,8 @@ private class PadEnumerable : IEnumerable {
} }
~PadEnumerable () { ~PadEnumerable () {
gst_iterator_free (iterator); if (iterator != IntPtr.Zero)
gst_iterator_free (iterator);
} }
} }