Skip to content

Commit

Permalink
Fix crash when doing :<space><enter>
Browse files Browse the repository at this point in the history
Introduced in #1577.
Fixes #1773.
  • Loading branch information
The-Compiler committed Aug 5, 2016
1 parent 30c7e4a commit 4541f19
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.asciidoc
Expand Up @@ -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
------

Expand Down
2 changes: 1 addition & 1 deletion qutebrowser/commands/runners.py
Expand Up @@ -119,7 +119,7 @@ def parse_all(self, text, aliases=True, *args, **kwargs):
Yields:
ParseResult tuples.
"""
if not text:
if not text.strip():
raise cmdexc.NoSuchCommandError("No command given")

if aliases:
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/commands/test_runners.py
Expand Up @@ -53,14 +53,16 @@ def test_parse_all_with_alias(self, cmdline_test, config_stub):
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."""
Expand Down

0 comments on commit 4541f19

Please sign in to comment.