#4 Patch to fix bug 1839105

open
nobody
None
5
2008-03-15
2008-03-15
Andrew
No

There is a null pointer exception if the hero dies before completing the first quest. This patch addresses that issue.

Also, I fixed a typo in Armour.java

Index: mikera/tyrant/Armour.java

RCS file: /cvsroot/tyrant/tyrant/mikera/tyrant/Armour.java,v
retrieving revision 1.39
diff -u -r1.39 Armour.java
--- mikera/tyrant/Armour.java 27 Nov 2006 18:50:25 -0000 1.39
+++ mikera/tyrant/Armour.java 15 Mar 2008 23:55:13 -0000
@@ -396,7 +396,7 @@
t.set("Armour",2);
t.set("LevelMin",10);
t.set("DefaultThings","100% [IsArmourRune]");
- t.multiplyStat("Frequnecy",0.2);
+ t.multiplyStat("Frequency",0.2);
Lib.add(t);

t=Lib.extend("mining cap","base helmet");
Index: mikera/tyrant/Quest.java
===================================================================
RCS file: /cvsroot/tyrant/tyrant/mikera/tyrant/Quest.java,v
retrieving revision 1.21
diff -u -r1.21 Quest.java
--- mikera/tyrant/Quest.java 27 Nov 2006 18:50:25 -0000 1.21
+++ mikera/tyrant/Quest.java 15 Mar 2008 23:55:13 -0000
@@ -264,6 +264,14 @@
public boolean handle(Thing q, Event e) {
Map targetMap=(Map)q.get("TargetMap");
Map heroMap=Game.hero().getMap();
+
+ // bug 1839105
+ // check to see if hero has already died to
+ // avoid null pointer exception
+ if (heroMap == null) {
+ return false;
+ }
+
if (targetMap==null) {
String targetMapName=q.getString("TargetMapName");
if (heroMap.name().startsWith(targetMapName)) {

Discussion

  • Andrew
    Andrew
    2008-03-15

    patch for bug 1839105 and fix of typo in Armour.java

     
    Attachments
  • Logged In: YES
    user_id=576710
    Originator: NO

    Thanks Andrew - werdnagreb - I committed you patch.

    -Chris