return None when there is no list or invalid cursor
[enigma2.git] / lib / gui / elistboxcontent.cpp
index ff93eac2191e93c550786e429a4792655dcb30d4..2b3c0fcd2948d230199661ba0098ddff136a59ca 100644 (file)
@@ -374,10 +374,11 @@ void eListboxPythonStringContent::setList(PyObject *list)
 
 PyObject *eListboxPythonStringContent::getCurrentSelection()
 {
-       if (!m_list)
-               return 0;
-       if (!cursorValid())
-               return 0;
+       if (!(m_list && cursorValid()))
+       {
+               Py_INCREF(Py_None);
+               return Py_None;
+       }
        PyObject *r = PyList_GET_ITEM(m_list, m_cursor);
        Py_XINCREF(r);
        return r;