fix: segfault when using /command help
Usually we use `/help command`. Additionally there is a shortcut
`/comamnd?`. 54fea4afcf tried to introduce
to have `/command help`. Which doesn't really work since most commands
get this as parameters. So it never worked. Additionally it introduced
at segfault because it tried to set *question_mark to NULL even we can
also get there without the `?` but by having the `help` as parameter.
This commit is contained in:
@@ -154,10 +154,8 @@ cmd_process_input(ProfWin* window, char* inp)
|
||||
if (inp[0] == '/') {
|
||||
auto_char char* inp_cpy = strdup(inp);
|
||||
char* command = strtok(inp_cpy, " ");
|
||||
char* second_word = strtok(NULL, " ");
|
||||
gboolean wants_help = second_word ? strcmp(second_word, "help") == 0 : FALSE;
|
||||
char* question_mark = strchr(command, '?');
|
||||
if (wants_help || question_mark) {
|
||||
if (question_mark) {
|
||||
*question_mark = '\0';
|
||||
auto_gchar gchar* fakeinp = g_strdup_printf("/help %s", command + 1);
|
||||
if (fakeinp) {
|
||||
|
||||
Reference in New Issue
Block a user