NimManager: make sure that summary_stack has items before pop
authorlittlesat <littlesat99@yahoo.com>
Mon, 21 Dec 2015 20:45:58 +0000 (21:45 +0100)
committerlittlesat <littlesat99@yahoo.com>
Mon, 21 Dec 2015 20:45:58 +0000 (21:45 +0100)
IndexError: pop from empty list error can occur if we are trying
to pop from summary_stack without checking that has items.

Cherry picked but slightly changed from: https://github.com/athoik/enigma2/commit/e107c43d0aead3286f13abcdafac7eda0b40f304

Thanks Adhoik!!!!

mytest.py

index 2c716de..3c21846 100644 (file)
--- a/mytest.py
+++ b/mytest.py
@@ -317,10 +317,10 @@ class Session:
                        self.summary = None
 
        def popSummary(self):
-               if self.summary is not None:
+               if self.summary:
                        self.summary.doClose()
-               self.summary = self.summary_stack.pop()
-               if self.summary is not None:
+               self.summary = self.summary_stack and self.summary_stack.pop()
+               if self.summary:
                        self.summary.show()
 
 profile("Standby,PowerKey")