Override set_focus to check for index error

This commit is contained in:
Nikhil Soni 2017-03-28 20:05:02 +05:30
parent 9c686ca14c
commit 70a0f87570

View File

@ -57,6 +57,10 @@ class LogBufferBox(urwid.ListBox):
self.master = master
urwid.ListBox.__init__(self, master.logbuffer)
def set_focus(self, index):
if 0 <= index < len(self.master.logbuffer):
super().set_focus(index)
def keypress(self, size, key):
key = common.shortcuts(key)
if key == "z":