summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2016-08-05 15:41:43 +0200
committerFlorian Bruhin <git@the-compiler.org>2016-08-07 11:21:05 +0200
commite9e2adb9a7bae733d16ba588b999b39225d3432e (patch)
tree1756cdc8c8cc5dbc6181c78bd8971410862c01e1
parent113675a0b5e2a63b94b602fdc00672cfb171bee5 (diff)
downloadqutebrowser-e9e2adb9a7bae733d16ba588b999b39225d3432e.tar.gz
qutebrowser-e9e2adb9a7bae733d16ba588b999b39225d3432e.zip
Fix crash when doing `:<space><enter>`
Introduced in #1577. Fixes #1773.
-rw-r--r--CHANGELOG.asciidoc8
-rw-r--r--qutebrowser/commands/runners.py2
-rw-r--r--tests/unit/commands/test_runners.py6
3 files changed, 13 insertions, 3 deletions
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 44c2f548b..56dce666b 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -14,6 +14,14 @@ This project adheres to http://semver.org/[Semantic Versioning].
// `Fixed` for any bug fixes.
// `Security` to invite users to upgrade in case of vulnerabilities.
+v0.8.3 (unreleased)
+-------------------
+
+Fixed
+~~~~~
+
+- Fixed crash when doing `:<space><enter>`, another corner-case introduced in v0.8.0
+
v0.8.2
------
diff --git a/qutebrowser/commands/runners.py b/qutebrowser/commands/runners.py
index d1f15a415..f020b9199 100644
--- a/qutebrowser/commands/runners.py
+++ b/qutebrowser/commands/runners.py
@@ -119,7 +119,7 @@ class CommandRunner(QObject):
Yields:
ParseResult tuples.
"""
- if not text:
+ if not text.strip():
raise cmdexc.NoSuchCommandError("No command given")
if aliases:
diff --git a/tests/unit/commands/test_runners.py b/tests/unit/commands/test_runners.py
index a16ad764a..50fcbde1c 100644
--- a/tests/unit/commands/test_runners.py
+++ b/tests/unit/commands/test_runners.py
@@ -53,14 +53,16 @@ class TestCommandRunner:
with pytest.raises(cmdexc.NoSuchCommandError):
list(cr.parse_all("alias_name"))
- def test_parse_empty_with_alias(self):
+ @pytest.mark.parametrize('command', ['', ' '])
+ def test_parse_empty_with_alias(self, command):
"""An empty command should not crash.
See https://github.com/The-Compiler/qutebrowser/issues/1690
+ and https://github.com/The-Compiler/qutebrowser/issues/1773
"""
cr = runners.CommandRunner(0)
with pytest.raises(cmdexc.NoSuchCommandError):
- list(cr.parse_all(''))
+ list(cr.parse_all(command))
def test_parse_with_count(self):
"""Test parsing of commands with a count."""