mirror of
https://github.com/cuberite/cuberite.git
synced 2025-01-08 11:57:39 +08:00
Command Blocks: fix a crash
* Don't store a temporary
This commit is contained in:
parent
abc96bb4ce
commit
90ce4ed2b8
@ -169,7 +169,7 @@ void cCommandBlockEntity::Execute()
|
|||||||
}
|
}
|
||||||
|
|
||||||
class CommandBlockOutCb :
|
class CommandBlockOutCb :
|
||||||
public cCommandOutputCallback
|
public cLogCommandDeleteSelfOutputCallback
|
||||||
{
|
{
|
||||||
cCommandBlockEntity * m_CmdBlock;
|
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->SetLastOutput(cClientHandle::FormatChatPrefix(m_CmdBlock->GetWorld()->ShouldUseChatPrefixes(), "SUCCESS", cChatColor::Green, cChatColor::White) + a_Text);
|
||||||
m_CmdBlock->GetWorld()->BroadcastBlockEntity(m_CmdBlock->GetPos());
|
m_CmdBlock->GetWorld()->BroadcastBlockEntity(m_CmdBlock->GetPos());
|
||||||
}
|
}
|
||||||
} CmdBlockOutCb(this);
|
};
|
||||||
|
|
||||||
AString RealCommand = m_Command;
|
AString RealCommand = m_Command;
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ void cCommandBlockEntity::Execute()
|
|||||||
{
|
{
|
||||||
cServer * Server = cRoot::Get()->GetServer();
|
cServer * Server = cRoot::Get()->GetServer();
|
||||||
LOGD("cCommandBlockEntity: Executing command %s", m_Command.c_str());
|
LOGD("cCommandBlockEntity: Executing command %s", m_Command.c_str());
|
||||||
Server->QueueExecuteConsoleCommand(RealCommand, CmdBlockOutCb);
|
Server->QueueExecuteConsoleCommand(RealCommand, *new CommandBlockOutCb(this));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user