diff --git a/ChangeLog b/ChangeLog index b7052e1465..f03a2733f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-01-08 Edward Hervey + + * gst/pygstiterator.c: (pygst_iterator_new): + * testsuite/test_iterator.py: + Raise an Exception when wrapping a NULL GstIterator. + Fixes #566903 + 2009-01-05 Alessandro Decina patch by: Vincent GENIEUX diff --git a/gst/pygstiterator.c b/gst/pygstiterator.c index 7d555f605a..d774a0e0d2 100644 --- a/gst/pygstiterator.c +++ b/gst/pygstiterator.c @@ -147,6 +147,11 @@ pygst_iterator_new (GstIterator * iter) { PyGstIterator *self; + if (iter == NULL) { + PyErr_SetString (PyExc_TypeError, "Invalid GstIterator (NULL)"); + return NULL; + } + self = PyObject_NEW (PyGstIterator, &PyGstIterator_Type); self->iter = iter; GST_DEBUG ("self:%p , iterator:%p, type:%lu", diff --git a/testsuite/test_iterator.py b/testsuite/test_iterator.py index 82f26da9c9..c6d75c0912 100644 --- a/testsuite/test_iterator.py +++ b/testsuite/test_iterator.py @@ -107,4 +107,11 @@ class IteratorTest(TestCase): break else: raise AssertionError - + + def testInvalidIterator(self): + p = gst.Pad("p", gst.PAD_SRC) + # The C function will return NULL, we should + # therefore have an exception raised + self.assertRaises(TypeError, p.iterate_internal_links) + del p +