mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
Fixed infinite execution of error CCMD
https://forum.zdoom.org/viewtopic.php?t=54659
This commit is contained in:
parent
b15e620ea8
commit
7dd51d6d1c
1 changed files with 15 additions and 3 deletions
|
@ -1523,8 +1523,6 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer)
|
|||
|
||||
buffer.Text.StripLeftRight();
|
||||
Printf(127, TEXTCOLOR_WHITE "]%s\n", buffer.Text.GetChars());
|
||||
AddCommandString(buffer.Text.LockBuffer());
|
||||
buffer.Text.UnlockBuffer();
|
||||
|
||||
if (buffer.Text.Len() == 0)
|
||||
{
|
||||
|
@ -1568,7 +1566,21 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer)
|
|||
}
|
||||
}
|
||||
HistPos = NULL;
|
||||
buffer.SetString("");
|
||||
{
|
||||
// Work with a copy of command to avoid side effects caused by
|
||||
// exception raised during execution, like with 'error' CCMD.
|
||||
// It's problematic to maintain FString's lock symmetry.
|
||||
static TArray<char> command;
|
||||
const size_t length = buffer.Text.Len();
|
||||
|
||||
command.Resize(length + 1);
|
||||
memcpy(&command[0], buffer.Text.GetChars(), length);
|
||||
command[length] = '\0';
|
||||
|
||||
buffer.SetString("");
|
||||
|
||||
AddCommandString(&command[0]);
|
||||
}
|
||||
TabbedLast = false;
|
||||
TabbedList = false;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue