[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [nyx/master] Fix 'AttributeError: 'NoneType' object has no attribute 'getmaxyx''



commit 1edd01f800d2a731b2f1620ad3072bd9fe94014b
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sun Mar 20 12:20:56 2016 -0700

    Fix 'AttributeError: 'NoneType' object has no attribute 'getmaxyx''
    
    Our _reset_subwindow() doesn't set our self.win attribute if we reside outside
    our parent (ie, aren't visible). I don't have a reliable repro for this but
    I've seen the following stacktrace a few times...
    
      File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
        return func(stdscr, *args, **kwds)
      File "/home/atagar/Desktop/nyx/nyx/curses.py", line 167, in _wrapper
        function()
      File "/home/atagar/Desktop/nyx/nyx/controller.py", line 399, in start_nyx
        control.redraw(False)
      File "/home/atagar/Desktop/nyx/nyx/controller.py", line 301, in redraw
        panel_impl.redraw(force)
      File "/home/atagar/Desktop/nyx/nyx/panel/__init__.py", line 440, in redraw
        subwin_max_y, subwin_max_x = self.win.getmaxyx()
      AttributeError: 'NoneType' object has no attribute 'getmaxyx'
---
 nyx/panel/__init__.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/nyx/panel/__init__.py b/nyx/panel/__init__.py
index 30b8b99..d4c7171 100644
--- a/nyx/panel/__init__.py
+++ b/nyx/panel/__init__.py
@@ -319,6 +319,9 @@ class Panel(object):
 
     is_new_window = self._reset_subwindow()
 
+    if not self.win:
+      return
+
     # The reset argument is disregarded in a couple of situations:
     # - The subwindow's been recreated (obviously it then doesn't have the old
     #   content to refresh).



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits