diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-07-27 13:58:14 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-07-27 13:58:14 +1000 |
commit | 9e7a2e9bb9976a0f23fad5c0c91b151ffa2db24c (patch) | |
tree | 46cc9b6faad47acd18908016e3957bdda6023491 /source/frontend/StarClientCommandProcessor.cpp | |
parent | f95fbc3a372cdffbc1d59894fa276db8802026bf (diff) |
only print Lua command result if it's not null
Diffstat (limited to 'source/frontend/StarClientCommandProcessor.cpp')
-rw-r--r-- | source/frontend/StarClientCommandProcessor.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/frontend/StarClientCommandProcessor.cpp b/source/frontend/StarClientCommandProcessor.cpp index def1b43..2d98289 100644 --- a/source/frontend/StarClientCommandProcessor.cpp +++ b/source/frontend/StarClientCommandProcessor.cpp @@ -91,9 +91,12 @@ StringList ClientCommandProcessor::handleCommand(String const& commandLine) { } } else { auto player = m_universeClient->mainPlayer(); - if (auto messageResult = player->receiveMessage(connectionForEntity(player->entityId()), "/" + command, { allArguments })) - result.append(messageResult->isType(Json::Type::String) ? *messageResult->stringPtr() : messageResult->repr(1, true)); - else + if (auto messageResult = player->receiveMessage(connectionForEntity(player->entityId()), "/" + command, {allArguments})) { + if (messageResult->isType(Json::Type::String)) + result.append(*messageResult->stringPtr()); + else if (!messageResult->isNull()) + result.append(messageResult->repr(1, true)); + } else m_universeClient->sendChat(commandLine, ChatSendMode::Broadcast); } return result; |