aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-07-16 23:51:39 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-07-16 23:51:39 +0100
commit23924c58707ee2a2aef039163edbbcc5d0746508 (patch)
tree99684a90c9f5f1b2e7a6246a66e2d4cff341062b
parent7ce688d7cf41055a607d933077664c1160ae0a30 (diff)
downloadpaludis-23924c58707ee2a2aef039163edbbcc5d0746508.tar.gz
paludis-23924c58707ee2a2aef039163edbbcc5d0746508.tar.xz
Check for null explicitly
-rwxr-xr-xpython/dep_spec_TEST.py2
-rw-r--r--python/slot_requirement.cc3
2 files changed, 5 insertions, 0 deletions
diff --git a/python/dep_spec_TEST.py b/python/dep_spec_TEST.py
index fb05ba2..9b28d28 100755
--- a/python/dep_spec_TEST.py
+++ b/python/dep_spec_TEST.py
@@ -63,6 +63,8 @@ class TestCase_1_DepSpecs(unittest.TestCase):
self.assert_(isinstance(self.pds.slot_requirement, SlotExactRequirement))
self.assertEqual(str(self.pds.slot_requirement.slot), "100")
+ self.assertEqual(self.pds2.slot_requirement, None)
+
def test_05_package(self):
self.get_depspecs()
self.assertEqual(str(self.pds.package), "foo/bar")
diff --git a/python/slot_requirement.cc b/python/slot_requirement.cc
index 09453d9..6cde772 100644
--- a/python/slot_requirement.cc
+++ b/python/slot_requirement.cc
@@ -72,6 +72,9 @@ namespace
static PyObject *
convert(const std::shared_ptr<const SlotRequirement> & m)
{
+ if (! m)
+ return Py_None;
+
SlotRequirementSptrToPythonVisitor v(m);
m->accept(v);
return bp::incref(v.obj.ptr());