Skip to content

Instantly share code, notes, and snippets.

@edsrzf
Created March 9, 2012 00:14
Show Gist options
  • Save edsrzf/2004278 to your computer and use it in GitHub Desktop.
Save edsrzf/2004278 to your computer and use it in GitHub Desktop.
From 4b9cbf6653ae06944d4ab469f362ba6711bbba67 Mon Sep 17 00:00:00 2001
From: Evan Shaw <edsrzf@gmail.com>
Date: Fri, 9 Mar 2012 13:12:15 +1300
Subject: [PATCH] Fix segfault for games with no monk class
When an unarmed character attacked, the engine tried to apply monk bonuses
even when no monk class was available, causing a segfault.
---
gemrb/core/Scriptable/Actor.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gemrb/core/Scriptable/Actor.cpp b/gemrb/core/Scriptable/Actor.cpp
index cd07e05..9f48c39 100644
--- a/gemrb/core/Scriptable/Actor.cpp
+++ b/gemrb/core/Scriptable/Actor.cpp
@@ -5065,7 +5065,7 @@ ieDword Actor::GetNumberOfAttacks() const
{
int bonus = 0;
- if (Equipped == IW_NO_EQUIPPED) {
+ if (monkbon != NULL && Equipped == IW_NO_EQUIPPED) {
unsigned int level = GetMonkLevel();
if (level>=monkbon_cols) level=monkbon_cols-1;
if (level>0) {
--
1.7.9.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment