Skip to content

Unexpected return in case GameMessage::MSG_CANCEL_UNIT_CREATE in GameLogic::logicMessageDispatcher #1211

Open
@xezon

Description

@xezon

The return statement is unexpected.

		case GameMessage::MSG_CANCEL_UNIT_CREATE:
		{
#if RETAIL_COMPATIBLE_AIGROUP
			Object *producer = getSingleObjectFromSelection(currentlySelectedGroup);
#else
			Object *producer = getSingleObjectFromSelection(currentlySelectedGroup.Peek());
#endif
			ProductionID productionID = (ProductionID)msg->getArgument( 0 )->integer;
			
			// sanity
			if( producer == NULL )
				break;
				
			// sanity, the player must control the producer			
			if( producer->getControllingPlayer() != thisPlayer )
				break;

			// get the unit production interface
			ProductionUpdateInterface *pu = producer->getProductionUpdateInterface();
			if( pu == NULL )
				return; // <------ THIS RETURN IS UNEXPECTED

			// cancel the production
			pu->cancelUnitCreate( productionID );

			break;

		}  // end GameMessage::MSG_CANCEL_UNIT_CREATE

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething is not working right, typically is user facingInvestigateMinorSeverity: Minor < Major < Critical < Blocker

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions