From 6fb16545ee974a0136b5d3cc41e9920cbfe08814 Mon Sep 17 00:00:00 2001 From: Max-Wilhelm Bruker Date: Tue, 14 Sep 2010 17:20:59 +0200 Subject: [PATCH] Fixed server crash when unattaching card --- common/server_protocolhandler.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/common/server_protocolhandler.cpp b/common/server_protocolhandler.cpp index 1d70464b..d34a3add 100644 --- a/common/server_protocolhandler.cpp +++ b/common/server_protocolhandler.cpp @@ -670,11 +670,14 @@ ResponseCode Server_ProtocolHandler::cmdAttachCard(Command_AttachCard *cmd, Comm return RespContextError; if (targetPlayer) targetzone = targetPlayer->getZones().value(cmd->getTargetZone()); - if (targetzone) + if (targetzone) { + // This is currently enough to make sure cards don't get attached to a card that is not on the table. + // Possibly a flag will have to be introduced for this sometime. + if (!targetzone->hasCoords()) + return RespContextError; targetCard = targetzone->getCard(cmd->getTargetCardId(), false); - // This is currently enough to make sure cards don't get attached to a card that is not on the table. - // Possibly a flag will have to be introduced for this sometime. - if (!startzone->hasCoords() || !targetzone->hasCoords()) + } + if (!startzone->hasCoords()) return RespContextError; // Get all arrows pointing to or originating from the card being attached and delete them.