small fix
authorghost <andreas.monzner@multimedia-labs.de>
Tue, 10 Mar 2009 11:11:18 +0000 (12:11 +0100)
committerghost <andreas.monzner@multimedia-labs.de>
Tue, 10 Mar 2009 11:11:18 +0000 (12:11 +0100)
lib/dvb_ci/dvbci.cpp

index a0166355b7c8391307ef5a04ba580e51ebe7d366..83bbed75c04ce8e7108c5835ea87347240cb552c 100644 (file)
@@ -926,10 +926,13 @@ PyObject *eDVBCIInterfaces::readCICaIds(int slotid)
        {
                int idx=0;
                eDVBCICAManagerSession *ca_manager = slot->getCAManager();
-               const std::vector<uint16_t> &ci_caids = ca_manager->getCAIDs();
-               ePyObject list = PyList_New(ci_caids.size());
-               for (std::vector<uint16_t>::const_iterator it = ci_caids.begin(); it != ci_caids.end(); ++it)
-                       PyList_SET_ITEM(list, idx++, PyLong_FromLong(*it));
+               const std::vector<uint16_t> *ci_caids = ca_manager ? &ca_manager->getCAIDs() : 0;
+               ePyObject list = PyList_New(ci_caids ? ci_caids->size() : 0);
+               if (ci_caids)
+               {
+                       for (std::vector<uint16_t>::const_iterator it = ci_caids->begin(); it != ci_caids->end(); ++it)
+                               PyList_SET_ITEM(list, idx++, PyLong_FromLong(*it));
+               }
                return list;
        }
        return 0;