Bail out of search_mode before editing (rather than after) if no entries match the search

This commit is contained in:
Richard Schneider 2022-11-11 15:37:25 -06:00
parent e6e08e5d3e
commit fce5afff06

View file

@ -183,8 +183,12 @@ def search_mode(args: "Namespace", journal: Journal, **kwargs) -> None:
_filter_journal_entries(**kwargs) _filter_journal_entries(**kwargs)
_print_entries_found_count(len(journal), args) _print_entries_found_count(len(journal), args)
if not journal:
# Bail out if there are no entries
return
# Where do the search results go? # Where do the search results go?
if args.edit: elif args.edit:
# If we want to both edit and change time in one action # If we want to both edit and change time in one action
if args.change_time: if args.change_time:
# Generate a new list instead of assigning so it won't be # Generate a new list instead of assigning so it won't be
@ -202,11 +206,6 @@ def search_mode(args: "Namespace", journal: Journal, **kwargs) -> None:
journal.entries = selected_entries journal.entries = selected_entries
_edit_search_results(**kwargs) _edit_search_results(**kwargs)
elif not journal:
# Bail out if there are no entries and we're not editing
return
elif args.change_time: elif args.change_time:
_change_time_search_results(**kwargs) _change_time_search_results(**kwargs)