diff --git a/src/clipmenu.c b/src/clipmenu.c index 434f3ca..7ea297e 100644 --- a/src/clipmenu.c +++ b/src/clipmenu.c @@ -16,6 +16,8 @@ static int dmenu_user_argc; static char **dmenu_user_argv; +#define HASH_INVALID UINT64_MAX + /** * Calculate the base 10 padding length for a number. */ @@ -136,6 +138,7 @@ static int _nonnull_ interact_with_dmenu(struct config *cfg, int *input_pipe, int forced_ret = 0; if (str_to_uint64(sel_idx_str, &sel_idx) < 0 || sel_idx == 0 || sel_idx > cur_clips) { + *out_hash = HASH_INVALID; forced_ret = EXIT_FAILURE; } else { *out_hash = idx_to_hash[sel_idx - 1]; @@ -179,7 +182,7 @@ int main(int argc, char *argv[]) { uint64_t hash; int dmenu_exit_code = prompt_user_for_hash(&cfg, &hash); - if (dmenu_exit_code == EXIT_SUCCESS) { + if (dmenu_exit_code == EXIT_SUCCESS && hash != HASH_INVALID) { run_clipserve(hash); }