mirror of
				https://github.com/DarkflameUniverse/DarkflameServer.git
				synced 2025-10-30 20:22:04 +00:00 
			
		
		
		
	fix: get entity from manager vs from character (#1833)
fixes a possible crash due to null entity
This commit is contained in:
		| @@ -167,6 +167,7 @@ Entity::~Entity() { | ||||
|  | ||||
| 	if (m_Character) { | ||||
| 		m_Character->SaveXMLToDatabase(); | ||||
| 		m_Character->SetEntity(nullptr); | ||||
| 	} | ||||
|  | ||||
| 	CancelAllTimers(); | ||||
|   | ||||
| @@ -526,7 +526,7 @@ void UserManager::LoginCharacter(const SystemAddress& sysAddr, uint32_t playerID | ||||
| 		ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, zoneID, character->GetZoneClone(), false, [=](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) { | ||||
| 			LOG("Transferring %s to Zone %i (Instance %i | Clone %i | Mythran Shift: %s) with IP %s and Port %i", character->GetName().c_str(), zoneID, zoneInstance, zoneClone, mythranShift == true ? "true" : "false", serverIP.c_str(), serverPort); | ||||
| 			if (character) { | ||||
| 				auto* entity = character->GetEntity(); | ||||
| 				auto* entity = Game::entityManager->GetEntity(character->GetObjectID()); | ||||
| 				if (entity) { | ||||
| 					auto* characterComponent = entity->GetComponent<CharacterComponent>(); | ||||
| 					if (characterComponent) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 David Markowitz
					David Markowitz