initialize m_cursor, fix cursorValid
[enigma2.git] / lib / gui / elistboxcontent.cpp
index 081bde706a7f6694d27efd3593910ef517314c89..e05da215913fc121cd4abc7d3dc3e4f39abfb600 100644 (file)
@@ -49,7 +49,7 @@ int iListboxContent::currentCursorSelectable()
 
 DEFINE_REF(eListboxPythonStringContent);
 
-eListboxPythonStringContent::eListboxPythonStringContent(): m_itemheight(25)
+eListboxPythonStringContent::eListboxPythonStringContent(): m_itemheight(25), m_cursor(0)
 {
 }
 
@@ -81,7 +81,7 @@ int eListboxPythonStringContent::cursorMove(int count)
 
 int eListboxPythonStringContent::cursorValid()
 {
-       return m_cursor < size();
+       return ((unsigned int)m_cursor) < size();
 }
 
 int eListboxPythonStringContent::cursorSet(int n)
@@ -909,6 +909,10 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c
 
                                if ((filled < 0) && data) /* if the string is in a negative number, it refers to the 'data' list. */
                                        filled = PyInt_AsLong(PyTuple_GetItem(data, -filled));
+                                       
+                                                       /* don't do anything if percent out of range */
+                               if ((filled < 0) || (filled > 100))
+                                       continue;
 
                                int bwidth = pborderWidth ? PyInt_AsLong(pborderWidth) : 2;