From 40dd65963d7819a3c566416827dd1c8dae5baf0e Mon Sep 17 00:00:00 2001 From: Divy Jain Date: Wed, 18 Nov 2020 15:13:11 +0530 Subject: [PATCH] #1141: Fix crash on empty history (#1145) --- tests/test_types.py | 1 + thefuck/entrypoints/fix_command.py | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/test_types.py b/tests/test_types.py index bea8f59..3a43cde 100644 --- a/tests/test_types.py +++ b/tests/test_types.py @@ -139,6 +139,7 @@ class TestCommand(object): env=os_environ) @pytest.mark.parametrize('script, result', [ + ([], None), ([''], None), (['', ''], None), (['ls', '-la'], 'ls -la'), diff --git a/thefuck/entrypoints/fix_command.py b/thefuck/entrypoints/fix_command.py index e3e3b01..6946653 100644 --- a/thefuck/entrypoints/fix_command.py +++ b/thefuck/entrypoints/fix_command.py @@ -23,6 +23,7 @@ def _get_raw_command(known_args): diff = SequenceMatcher(a=alias, b=command).ratio() if diff < const.DIFF_WITH_ALIAS or command in executables: return [command] + return [] def fix_command(known_args):