svn commit: r153173 - jakarta/bcel/trunk/src/java/org/apache/bcel/generic/LocalVariableGen.java

[email protected]
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <[email protected]>
Author: dbrosius
Date: Wed Feb  9 22:35:15 2005
New Revision: 153173

URL: http://svn.apache.org/viewcvs?view=rev&rev=153173
Log:
Guard against null InstructionHandle's when calculating hashCode

Modified:
    jakarta/bcel/trunk/src/java/org/apache/bcel/generic/LocalVariableGen.java

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/LocalVariableGen.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/LocalVariableGen.java?view=diff&r1=153172&r2=153173
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/LocalVariableGen.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/LocalVariableGen.java Wed Feb  9 22:35:15 2005
@@ -141,7 +141,14 @@
 
   /** @return a hash code value for the object.
    */
-  public int hashCode() { return index ^ start.hashCode() ^ end.hashCode(); }
+  public int hashCode() { 
+    int hc = index;
+    if (start != null)
+      hc ^= start.hashCode();
+    if (end != null) 
+      hc ^= end.hashCode();
+    return hc;
+  }
 
   /**
    * We consider to local variables to be equal, if the use the same index and
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.