37 lines
1.3 KiB
Diff
37 lines
1.3 KiB
Diff
From: Markus Koschany <apo@debian.org>
|
|
Date: Sun, 7 May 2017 18:46:50 +0200
|
|
Subject: segfault reactionfire mode bug 861979
|
|
|
|
Forwarded: http://ufoai.org/forum/index.php/topic,9111.0.html
|
|
Origin: https://sourceforge.net/p/ufoai/code/ci/9cad041f0931b1f49e0c70f32e351a7227f0d2ff/
|
|
---
|
|
src/game/inv_shared.cpp | 7 ++-----
|
|
1 file changed, 2 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/src/game/inv_shared.cpp b/src/game/inv_shared.cpp
|
|
index 708e708..e5a73a5 100644
|
|
--- a/src/game/inv_shared.cpp
|
|
+++ b/src/game/inv_shared.cpp
|
|
@@ -633,9 +633,6 @@ const fireDef_t* Item::getSlowestFireDef () const
|
|
*/
|
|
const objDef_t* Item::getReactionFireWeaponType () const
|
|
{
|
|
- if (!this)
|
|
- return nullptr;
|
|
-
|
|
if (def()) {
|
|
const fireDef_t* fd = getFiredefs();
|
|
if (fd && fd->reaction)
|
|
@@ -999,9 +996,9 @@ Item* Inventory::findInContainer (const containerIndex_t contId, const Item* con
|
|
*/
|
|
bool Inventory::holdsReactionFireWeapon () const
|
|
{
|
|
- if (getRightHandContainer()->getReactionFireWeaponType())
|
|
+ if (getRightHandContainer() != nullptr && getRightHandContainer()->getReactionFireWeaponType())
|
|
return true;
|
|
- if (getLeftHandContainer()->getReactionFireWeaponType())
|
|
+ if (getLeftHandContainer() != nullptr && getLeftHandContainer()->getReactionFireWeaponType())
|
|
return true;
|
|
return false;
|
|
}
|