Fix crashe with no current tab in _run_userscript

Not sure why this was a FIXME instead of handling it properly in the first place...
This commit is contained in:
Florian Bruhin 2022-10-21 10:19:30 +02:00
parent a4083e005a
commit 93b81f2e2e
2 changed files with 3 additions and 1 deletions

View File

@ -118,6 +118,7 @@ Fixed
when only the text matches.
- The `progress` and `backforward` statusbar widgets now stay removed if you
choose to remove them. Previously they would appear again on navigation.
- Rare crash when running userscripts with crashed renderer processes.
[[v2.5.3]]
v2.5.3 (unreleased)

View File

@ -1191,8 +1191,9 @@ class CommandDispatcher:
env['QUTE_TAB_INDEX'] = str(idx + 1)
env['QUTE_TITLE'] = self._tabbed_browser.widget.page_title(idx)
# FIXME:qtwebengine: If tab is None, run_async will fail!
tab = self._tabbed_browser.widget.currentWidget()
if tab is None:
raise cmdutils.CommandError("No current tab!")
try:
url = self._tabbed_browser.current_url()