diff --git a/CHANGELOG b/CHANGELOG index 60ad716cf8..8f20d381ed 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -66,9 +66,10 @@ Other Fixes: * Added a workaround for broken ratman backflip in intro (bug #93) * Fixed a crash when dragging an entity without a 3D object (bug #1592) +* Fixed a crash when using a weapon without a 3D object (bug #1286) * Fixed a crash when an equipped candle is destroyed (bug #1622) * Fixed a crash with negative (or zero with -i) intervals in the `timer` command -* Fixed a crash when loading save files with linked items inside an inventory +* Fixed a crash when loading save files with linked items inside an inventory (bug #1618) * Fixed linked entities being removed from NPC inventories even if linked to the owning NPC * Fixed the `replaceme` script command for NPC weapons not equipping the new weapon diff --git a/src/game/Equipment.cpp b/src/game/Equipment.cpp index 995ec4e3e3..b1b04f9026 100644 --- a/src/game/Equipment.cpp +++ b/src/game/Equipment.cpp @@ -603,13 +603,17 @@ bool ARX_EQUIPMENT_Strike_Check(Entity * io_source, Entity * io_weapon, float ra arx_assert(io_source); arx_assert(io_weapon); + if(!io_weapon->obj) { + return false; + } + bool ret = false; EXCEPTIONS_LIST_Pos = 0; - + float drain_life = ARX_EQUIPMENT_GetSpecialValue(io_weapon, IO_SPECIAL_ELEM_DRAIN_LIFE); float paralyse = ARX_EQUIPMENT_GetSpecialValue(io_weapon, IO_SPECIAL_ELEM_PARALYZE); - + for(const EERIE_ACTIONLIST & action : io_weapon->obj->actionlist) { float rad = GetHitValue(action.name); @@ -629,6 +633,7 @@ bool ARX_EQUIPMENT_Strike_Check(Entity * io_source, Entity * io_weapon, float ra if(CheckEverythingInSphere(sphere, io_source, entities.get(targ), sphereContent)) { for(Entity * target : sphereContent) { arx_assert(target); + arx_assert(target->obj); { bool HIT_SPARK = false;