Skip to content

Commit

Permalink
ALIASEDIT: Fix random characters appearing at end
Browse files Browse the repository at this point in the history
  • Loading branch information
meag committed Apr 18, 2020
1 parent 8cb9002 commit 2bee366
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
15 changes: 7 additions & 8 deletions cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -712,16 +712,15 @@ void Cmd_EditAlias_f (void)
}

a = Cmd_FindAlias(Cmd_Argv(1));
if ( a == NULL ) {
s = Q_strdup("");
} else {
s = Q_strdup(a->value);
}
s = (a ? a->value : "");

snprintf(final_string, sizeof(final_string), "/alias \"%s\" \"%s\"", Cmd_Argv(1), s);
strlcpy(final_string, "/alias \"", sizeof(final_string));
strlcat(final_string, Cmd_Argv(1), sizeof(final_string));
strlcat(final_string, "\" \"", sizeof(final_string));
strlcat(final_string, s, sizeof(final_string));
strlcat(final_string, "\"", sizeof(final_string));
Key_ClearTyping();
memcpy (key_lines[edit_line]+1, str2wcs(final_string), strlen(final_string)*sizeof(wchar));
Q_free(s);
memcpy(key_lines[edit_line]+1, str2wcs(final_string), (strlen(final_string) + 1) * sizeof(wchar));
}

static cmd_alias_t* Cmd_AliasCreate (char* name)
Expand Down
1 change: 1 addition & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
- {} white-text wasn't stripped from item name cvars
- Halflife maps had wrong bounding box sizes
- `hud_sortrules_includeself 0` could lead to player not being included in visible list
- `aliasedit` could result in the end of previously entered text to appear at end of line

### Other changes

Expand Down

0 comments on commit 2bee366

Please sign in to comment.