From f2ebe247badd6b60a313267dff3e8f1fb8a27ac5 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 25 May 2022 13:40:49 -0400 Subject: [PATCH] Core/Unit: Fix crash when exiting a vehicle Port From (https://github.com/TrinityCore/TrinityCore/commit/c93d6856c727b5919ae30e04fb17bb425370ebea) --- Source/Game/Entities/Unit/Unit.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/Game/Entities/Unit/Unit.cs b/Source/Game/Entities/Unit/Unit.cs index 0d38b726d..1818bbcf8 100644 --- a/Source/Game/Entities/Unit/Unit.cs +++ b/Source/Game/Entities/Unit/Unit.cs @@ -1030,6 +1030,12 @@ namespace Game.Entities VehicleSeatAddon seatAddon = m_vehicle.GetSeatAddonForSeatOfPassenger(this); Vehicle vehicle = m_vehicle.RemovePassenger(this); + if (vehicle == null) + { + Log.outError(LogFilter.Vehicle, $"RemovePassenger() couldn't remove current unit from vehicle. Debug info: {GetDebugInfo()}"); + return; + } + Player player = ToPlayer(); // If the player is on mounted duel and exits the mount, he should immediatly lose the duel