summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-01-15 10:11:53 +0100
committerFlorian Bruhin <me@the-compiler.org>2021-01-15 10:11:53 +0100
commit9d3e675296a5f0aaf0ccd2766a58a68b621e3452 (patch)
treedee46da54c630c20e8ef5e5b2b0f4578a9483e27
parentc3f469b37e9cc5faaf55f6b586a4fcc29bc16e31 (diff)
downloadqutebrowser-9d3e675296a5f0aaf0ccd2766a58a68b621e3452.tar.gz
qutebrowser-9d3e675296a5f0aaf0ccd2766a58a68b621e3452.zip
Fix :tab-only without tabs
e.g. when running 'qutebrowser --temp-basedir :tab-only'
-rw-r--r--doc/changelog.asciidoc2
-rw-r--r--qutebrowser/browser/commands.py3
2 files changed, 4 insertions, 1 deletions
diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc
index 8190540f8..cf2faf9e6 100644
--- a/doc/changelog.asciidoc
+++ b/doc/changelog.asciidoc
@@ -170,6 +170,8 @@ Fixed
contains a proper extension. Before this fix, qutebrowser would use the URL's
data contents as filename with QtWebEngine; or "binary blob" with the Qt network
stack.
+- When `:tab-only` is run before a tab is available, an error is now shown
+ instead of crashing.
- TODO: Due to a long-standing bug in the `pkg_resources` dependency, it caused
qutebrowser's startup to slow down by around 150ms-1s (heavily depending on
the system). Since the dependency is now removed, qutebrowser's startup time
diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py
index ec43a3210..936af5402 100644
--- a/qutebrowser/browser/commands.py
+++ b/qutebrowser/browser/commands.py
@@ -764,7 +764,8 @@ class CommandDispatcher:
"""
cmdutils.check_exclusive((prev, next_), 'pn')
cur_idx = self._tabbed_browser.widget.currentIndex()
- assert cur_idx != -1
+ if cur_idx == -1:
+ raise cmdutils.CommandError("Failed to get current tab for :tab-only")
def _to_close(i):
"""Helper method to check if a tab should be closed or not."""