diff options
Diffstat (limited to 'source/game')
-rw-r--r-- | source/game/StarUniverseClient.cpp | 10 | ||||
-rw-r--r-- | source/game/StarWorldClient.cpp | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/source/game/StarUniverseClient.cpp b/source/game/StarUniverseClient.cpp index 9a1f31b..394cacc 100644 --- a/source/game/StarUniverseClient.cpp +++ b/source/game/StarUniverseClient.cpp @@ -258,7 +258,15 @@ void UniverseClient::update(float dt) { } m_connection->receive(); - handlePackets(m_connection->pull()); + try { + handlePackets(m_connection->pull()); + } + catch (StarException const& e) { + Logger::error("Exception caught handling incoming server packets {}", outputException(e, true)); + reset(); + if (!m_disconnectReason) + m_disconnectReason = String("Exception caught handling incoming server packets, check log"); + } if (!isConnected()) return; diff --git a/source/game/StarWorldClient.cpp b/source/game/StarWorldClient.cpp index 8db6a62..42b031a 100644 --- a/source/game/StarWorldClient.cpp +++ b/source/game/StarWorldClient.cpp @@ -1068,7 +1068,7 @@ void WorldClient::handleIncomingPackets(List<PacketPtr> const& packets) { } else if (auto entityInteract = as<EntityInteractPacket>(packet)) { auto interactResult = interact(entityInteract->interactRequest).result(); - m_outgoingPackets.append(make_shared<EntityInteractResultPacket>(interactResult.take(), entityInteract->requestId, entityInteract->interactRequest.sourceId)); + m_outgoingPackets.append(make_shared<EntityInteractResultPacket>(interactResult.value(), entityInteract->requestId, entityInteract->interactRequest.sourceId)); } else if (auto interactResult = as<EntityInteractResultPacket>(packet)) { if (auto response = m_entityInteractionResponses.maybeTake(interactResult->requestId)) { |