make sure there IS a current widget before using it

This commit is contained in:
Marc Jauvin 2018-02-14 08:33:32 -05:00
parent 9b8a182a78
commit 8a3049f09b

View File

@ -637,7 +637,9 @@ class TabbedBrowser(tabwidget.TabWidget):
input_modes = [usertypes.KeyMode.insert, usertypes.KeyMode.passthrough] input_modes = [usertypes.KeyMode.insert, usertypes.KeyMode.passthrough]
if (mode in input_modes and if (mode in input_modes and
config.val.tabs.mode_on_change == 'restore'): config.val.tabs.mode_on_change == 'restore'):
self.currentWidget().data.input_mode = mode tab = self.currentWidget()
if tab != 0:
tab.data.input_mode = mode
@pyqtSlot(usertypes.KeyMode) @pyqtSlot(usertypes.KeyMode)
def on_mode_left(self, mode): def on_mode_left(self, mode):
@ -651,7 +653,9 @@ class TabbedBrowser(tabwidget.TabWidget):
return return
widget.setFocus() widget.setFocus()
elif config.val.tabs.mode_on_change == 'restore': elif config.val.tabs.mode_on_change == 'restore':
self.currentWidget().data.input_mode = usertypes.KeyMode.normal tab = self.currentWidget()
if tab != 0:
tab.data.input_mode = usertypes.KeyMode.normal
@pyqtSlot(int) @pyqtSlot(int)
def on_current_changed(self, idx): def on_current_changed(self, idx):