Commit 3b6ab117 authored by Edward Hervey's avatar Edward Hervey 🤘

Raise an Exception when wrapping a NULL GstIterator.

Original commit message from CVS:
* gst/pygstiterator.c: (pygst_iterator_new):
* testsuite/test_iterator.py:
Raise an Exception when wrapping a NULL GstIterator.
Fixes #566903
parent 405b0751
2009-01-08 Edward Hervey <edward.hervey@collabora.co.uk>
* 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 <alessandro.decina@collabora.co.uk>
patch by: Vincent GENIEUX <mutex at runbox dot com>
......
......@@ -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",
......
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment