Skip to content

Commit

Permalink
Merge pull request #18 from morozsm/issue-17
Browse files Browse the repository at this point in the history
Fix crash on malformed history #17 by @morozsm
  • Loading branch information
meteoritt authored Nov 20, 2020
2 parents 2d2800a + b312962 commit 33e6b3f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion topalias/aliascore.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ def load_command_bank(filtering=False): # pylint: disable=too-many-branches
history_file_path = find_history()
try:
with io.FileIO(r"{}".format(history_file_path), "r") as history_data:
history_data_encoded = io.TextIOWrapper(history_data, encoding="UTF-8")
history_data_encoded = io.TextIOWrapper(
history_data,
encoding="UTF-8",
errors="ignore",
)
for line in history_data_encoded:
if HISTORY_FILE == ".bash_history":
if (not line.startswith("#", 0, 1)) and line != "":
Expand Down

0 comments on commit 33e6b3f

Please sign in to comment.