diff --git a/modes/run.c b/modes/run.c index 98c97fd..089c8ce 100644 --- a/modes/run.c +++ b/modes/run.c @@ -23,8 +23,17 @@ void wofi_run_init() { struct cache_line* node, *tmp; wl_list_for_each_safe(node, tmp, cache, link) { - char* text = strrchr(node->line, '/') + 1; - char* search_text = utils_concat(2, text, node->line); + char* text; + char* search_prefix; + char* final_slash = strrchr(node->line, '/'); + if(final_slash == NULL) { + text = node->line; + search_prefix = ""; + } else { + text = final_slash + 1; + search_prefix = text; + } + char* search_text = utils_concat(2, search_prefix, node->line); wofi_insert_widget("run", text, search_text, node->line); map_put(cached, node->line, "true"); free(search_text);