From 7b7b7df7b8781b40eb86142fa4f9779fdb26e095 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Wed, 30 Dec 2020 16:36:59 -0800 Subject: [PATCH] Fix crash bug in project command lister --- custom/4coder_project_commands.cpp | 6 ++++-- custom/generated/command_metadata.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/custom/4coder_project_commands.cpp b/custom/4coder_project_commands.cpp index fbaffebe..5ea66d45 100644 --- a/custom/4coder_project_commands.cpp +++ b/custom/4coder_project_commands.cpp @@ -1339,8 +1339,10 @@ get_project_command_from_user(Application_Links *app, Project *project, String_C Lister_Result l_result = run_lister(app, lister); if (!l_result.canceled){ Project_Command *result_proj_cmd = (Project_Command*)l_result.user_data; - String_Const_u8 cmd_name = prj_sanitize_string(scratch, result_proj_cmd->name); - result = prj_command_from_name(app, cmd_name); + if (result_proj_cmd != 0){ + String_Const_u8 cmd_name = prj_sanitize_string(scratch, result_proj_cmd->name); + result = prj_command_from_name(app, cmd_name); + } } } diff --git a/custom/generated/command_metadata.h b/custom/generated/command_metadata.h index ab750ab5..fa28689d 100644 --- a/custom/generated/command_metadata.h +++ b/custom/generated/command_metadata.h @@ -436,7 +436,7 @@ static Command_Metadata fcoder_metacmd_table[250] = { { PROC_LINKS(profile_disable, 0), false, "profile_disable", 15, "Prevent 4coder's self profiler from gathering new profiling information.", 72, "W:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 219 }, { PROC_LINKS(profile_enable, 0), false, "profile_enable", 14, "Allow 4coder's self profiler to gather new profiling information.", 65, "W:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 212 }, { PROC_LINKS(profile_inspect, 0), true, "profile_inspect", 15, "Inspect all currently collected profiling information in 4coder's self profiler.", 80, "W:\\4ed\\code\\custom\\4coder_profile_inspect.cpp", 45, 886 }, -{ PROC_LINKS(project_command_lister, 0), false, "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1350 }, +{ PROC_LINKS(project_command_lister, 0), false, "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1352 }, { PROC_LINKS(project_fkey_command, 0), false, "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 936 }, { PROC_LINKS(project_go_to_root_directory, 0), false, "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 962 }, { PROC_LINKS(query_replace, 0), false, "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1282 },