summaryrefslogtreecommitdiffstats
path: root/games/ufoai/patches/segfault-reactionfire-mode-bug-861979.patch
blob: d8575fe169dce8a1ab1d96d8de6be5d302e88009 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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;
 }