1
0
Fork 0

Command Blocks: fix a crash

* Don't store a temporary
This commit is contained in:
Tiger Wang 2020-12-29 22:01:38 +00:00
parent abc96bb4ce
commit 90ce4ed2b8
1 changed files with 3 additions and 3 deletions

View File

@ -169,7 +169,7 @@ void cCommandBlockEntity::Execute()
}
class CommandBlockOutCb :
public cCommandOutputCallback
public cLogCommandDeleteSelfOutputCallback
{
cCommandBlockEntity * m_CmdBlock;
@ -182,7 +182,7 @@ void cCommandBlockEntity::Execute()
m_CmdBlock->SetLastOutput(cClientHandle::FormatChatPrefix(m_CmdBlock->GetWorld()->ShouldUseChatPrefixes(), "SUCCESS", cChatColor::Green, cChatColor::White) + a_Text);
m_CmdBlock->GetWorld()->BroadcastBlockEntity(m_CmdBlock->GetPos());
}
} CmdBlockOutCb(this);
};
AString RealCommand = m_Command;
@ -203,7 +203,7 @@ void cCommandBlockEntity::Execute()
{
cServer * Server = cRoot::Get()->GetServer();
LOGD("cCommandBlockEntity: Executing command %s", m_Command.c_str());
Server->QueueExecuteConsoleCommand(RealCommand, CmdBlockOutCb);
Server->QueueExecuteConsoleCommand(RealCommand, *new CommandBlockOutCb(this));
}
else
{