[tor-commits] [arm/release] fix: Selection crashed an empty connection panel

atagar at torproject.org atagar at torproject.org
Sun Jul 17 06:08:18 UTC 2011


commit 9fbed0c32c88b534b79485748031996ec2b05946
Author: Damian Johnson <atagar at torproject.org>
Date:   Mon May 9 18:55:58 2011 -0700

    fix: Selection crashed an empty connection panel
    
    If there were no connection results, pressing enter on the connection page
    would crash arm. This isn't a commonly encountered use case, but could arise
    if you both lack permissions to query connections and don't have any circuits.
    
    Caught by asn (https://trac.torproject.org/projects/tor/ticket/3128)
---
 src/cli/connections/connPanel.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/cli/connections/connPanel.py b/src/cli/connections/connPanel.py
index 4d89d5c..36687ac 100644
--- a/src/cli/connections/connPanel.py
+++ b/src/cli/connections/connPanel.py
@@ -151,7 +151,7 @@ class ConnectionPanel(panel.Panel, threading.Thread):
       if self._showDetails: pageHeight -= (DETAILS_HEIGHT + 1)
       isChanged = self._scroller.handleKey(key, self._entryLines, pageHeight)
       if isChanged: self.redraw(True)
-    elif uiTools.isSelectionKey(key):
+    elif uiTools.isSelectionKey(key) and self._entries:
       self._showDetails = not self._showDetails
       self.redraw(True)
     elif key == ord('s') or key == ord('S'):
@@ -256,7 +256,7 @@ class ConnectionPanel(panel.Panel, threading.Thread):
     cursorSelection = self._scroller.getCursorSelection(self._entryLines)
     
     # draws the detail panel if currently displaying it
-    if self._showDetails:
+    if self._showDetails and cursorSelection:
       # This is a solid border unless the scrollbar is visible, in which case a
       # 'T' pipe connects the border to the bar.
       uiTools.drawBox(self, 0, 0, width, DETAILS_HEIGHT + 2)





More information about the tor-commits mailing list