Handle event_target() being None

As a stop-gap solution for #3888
This commit is contained in:
Florian Bruhin 2018-05-03 14:45:55 +02:00
parent 80778a9ff3
commit 2b6b4e82a7
2 changed files with 7 additions and 3 deletions

View File

@ -724,7 +724,13 @@ class AbstractTab(QWidget):
if getattr(evt, 'posted', False):
raise utils.Unreachable("Can't re-use an event which was already "
"posted!")
recipient = self.event_target()
if recipient is None:
# https://github.com/qutebrowser/qutebrowser/issues/3888
log.webview.warning("Unable to find event target!")
return
evt.posted = True
QApplication.postEvent(recipient, evt)

View File

@ -1104,6 +1104,4 @@ class WebEngineTab(browsertab.AbstractTab):
self.predicted_navigation.connect(self._on_predicted_navigation)
def event_target(self):
fp = self._widget.focusProxy()
assert fp is not None
return fp
return self._widget.focusProxy()