[tor-commits] [nyx/master] Stacktrace if all panels are disabled

atagar at torproject.org atagar at torproject.org
Sat Sep 16 19:16:56 UTC 2017


commit 148e213782b57587ab88b8b4eca2e3bceecd8017
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Sep 16 12:15:56 2017 -0700

    Stacktrace if all panels are disabled
    
    If the nyxrc disables all our panels except the header then we crash with...
    
      Traceback (most recent call last):
        File "/home/ubuntu/nyx/run_nyx", line 14, in <module>
          nyx.main()
        File "/home/ubuntu/nyx/nyx/__init__.py", line 137, in main
          nyx.starter.main()
        File "/home/ubuntu/nyx/stem/util/conf.py", line 289, in wrapped
          return func(*args, config = config, **kwargs)
        File "/home/ubuntu/nyx/nyx/starter.py", line 94, in main
          nyx.curses.start(nyx.draw_loop, acs_support = config.get('acs_support', True), transparent_background = True, cursor = False)
        File "/home/ubuntu/nyx/nyx/curses.py", line 216, in start
          curses.wrapper(_wrapper)
        File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
          return func(stdscr, *args, **kwds)
        File "/home/ubuntu/nyx/nyx/curses.py", line 214, in _wrapper
          function()
        File "/home/ubuntu/nyx/nyx/__init__.py", line 155, in draw_loop
          interface = nyx_interface()
        File "/home/ubuntu/nyx/nyx/__init__.py", line 217, in nyx_interface
          Interface()  # constructor sets NYX_INTERFACE
        File "/home/ubuntu/nyx/nyx/__init__.py", line 574, in __init__
          visible_panels = self.page_panels()
        File "/home/ubuntu/nyx/nyx/__init__.py", line 638, in page_panels
          return [self._header_panel] + self._page_panels[page_number]
      IndexError: list index out of range
---
 nyx/__init__.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/nyx/__init__.py b/nyx/__init__.py
index 745ce31..c134a53 100644
--- a/nyx/__init__.py
+++ b/nyx/__init__.py
@@ -634,6 +634,9 @@ class Interface(object):
     :returns: **list** of panels on that page
     """
 
+    if not self._page_panels:
+      return [self._header_panel]  # all panels disabled
+
     page_number = self._page if page_number is None else page_number
     return [self._header_panel] + self._page_panels[page_number]
 



More information about the tor-commits mailing list