aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index a1c6a5d272d..e92fcfad94f 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -15213,8 +15213,8 @@ Unit *Unit::GetVehicleBase() const
Creature *Unit::GetVehicleCreatureBase() const
{
Unit *veh = GetVehicleBase();
- if (veh->GetTypeId() == TYPEID_UNIT)
- return (Creature*)veh;
+ if (veh && veh->GetTypeId() == TYPEID_UNIT)
+ return dynamic_cast<Creature*>(veh);
return NULL;
}