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

[or-cvs] r20097: {arm} Fixes for a couple of crashing mistakes in last commit. (arm/trunk/interface)



Author: atagar
Date: 2009-07-20 23:20:28 -0400 (Mon, 20 Jul 2009)
New Revision: 20097

Modified:
   arm/trunk/interface/connPanel.py
   arm/trunk/interface/headerPanel.py
Log:
Fixes for a couple of crashing mistakes in last commit.



Modified: arm/trunk/interface/connPanel.py
===================================================================
--- arm/trunk/interface/connPanel.py	2009-07-21 02:56:42 UTC (rev 20096)
+++ arm/trunk/interface/connPanel.py	2009-07-21 03:20:28 UTC (rev 20097)
@@ -228,7 +228,8 @@
       newLoc = max(0, min(newLoc, maxLoc))
       
       # applies to proper parameter
-      if self.isCursorEnabled: self.cursorSelection, self.cursorLoc = self.connections[newLoc], newLoc
+      if self.isCursorEnabled and self.connections:
+        self.cursorSelection, self.cursorLoc = self.connections[newLoc], newLoc
       else: self.scroll = newLoc
     elif key == ord('c') or key == ord('C'):
       self.isCursorEnabled = not self.isCursorEnabled

Modified: arm/trunk/interface/headerPanel.py
===================================================================
--- arm/trunk/interface/headerPanel.py	2009-07-21 02:56:42 UTC (rev 20096)
+++ arm/trunk/interface/headerPanel.py	2009-07-21 03:20:28 UTC (rev 20097)
@@ -145,9 +145,9 @@
       except TorCtl.ErrorReply: pass
       except socket.error: pass
     
+    psParams = ["%cpu", "rss", "%mem", "etime"]
     if self.vals["pid"]:
       # ps call provides header followed by params for tor
-      psParams = ["%cpu", "rss", "%mem", "etime"]
       psCall = os.popen('ps -p %s -o %s' % (self.vals["pid"], ",".join(psParams)))
       
       try: sampling = psCall.read().strip().split()[len(psParams):]