Protect 3-min refresh if buffer is empty

This commit is contained in:
Doug Blank 2013-11-16 09:29:45 -05:00
parent d8acf8e875
commit a3749090aa

View File

@ -340,14 +340,18 @@ class WarnHandler(RotateHandler):
self.button.show() self.button.show()
def _check_clear(self): def _check_clear(self):
new_last_line = self.get_buffer()[-1] buffer = self.get_buffer()
if self.last_line == new_last_line: if len(buffer) > 0:
#buffer has not changed for 3 minutes, let's clear it: new_last_line = self.get_buffer()[-1]
self._clear() if self.last_line == new_last_line:
return False #buffer has not changed for 3 minutes, let's clear it:
self._clear()
return False
else:
self.last_line = new_last_line
return True
else: else:
self.last_line = new_last_line return False
return True
def _clear(self): def _clear(self):
self.button.hide() self.button.hide()