diff --git a/interactions.c b/interactions.c index 6b7593c..1da14fc 100644 --- a/interactions.c +++ b/interactions.c @@ -258,20 +258,22 @@ void move_right(){ char match = 0; char *mime = get_mimetype(mid_content[selected_file_current].file_name); char *extension = strrchr(mid_content[selected_file_current].file_name, '.'); - for (i = 0; i < file_extension_default_count; i++) { - if (strstr(extension, file_extension_default_cmd[i].file_extension)) { - char *cmd = concat(file_extension_default_cmd[i].command, " ./\""); - cmd = concat(cmd, mid_content[selected_file_current].file_name); - cmd = concat(cmd, "\""); + if (extension != NULL) { + for (i = 0; i < file_extension_default_count; i++) { + if (strstr(extension, file_extension_default_cmd[i].file_extension)) { + char *cmd = concat(file_extension_default_cmd[i].command, " ./\""); + cmd = concat(cmd, mid_content[selected_file_current].file_name); + cmd = concat(cmd, "\""); - if (system(cmd) == -1) { - /*do nothing*/ + if (system(cmd) == -1) { + /*do nothing*/ + } + curs_set(1); /*for some reason, 1 here turns it invisible once again */ + match = 1; + status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY | STATUS_UPDATE_SCREEN_RELOAD_FULL); + break; } - curs_set(1); /*for some reason, 1 here turns it invisible once again */ - match = 1; - status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY | STATUS_UPDATE_SCREEN_RELOAD_FULL); - break; } } if (match == 0) {