Fix crash when doing :<space><enter>

Introduced in #1577.
Fixes #1773.
This commit is contained in:
Florian Bruhin 2016-08-05 15:41:43 +02:00
parent 30c7e4a152
commit 4541f19195
3 changed files with 13 additions and 3 deletions

View File

@ -45,6 +45,14 @@ Changed
- `:download-open` and `:prompt-open-download` now have an optional `cmdline`
argument to pass a commandline to open the download with.
v0.8.3 (unreleased)
-------------------
Fixed
~~~~~
- Fixed crash when doing `:<space><enter>`, another corner-case introduced in v0.8.0
v0.8.2
------

View File

@ -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:

View File

@ -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."""