cvs commit: jakarta-bcel/src/java/org/apache/bcel/generic ReturnaddressType.java

[email protected]
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <[email protected]>
mdahm       2003/07/28 00:04:41

  Modified:    src/java/org/apache/bcel/generic ReturnaddressType.java
  Log:
  Bug fix: equals threw NullPointer
  
  Revision  Changes    Path
  1.2       +7 -2      jakarta-bcel/src/java/org/apache/bcel/generic/ReturnaddressType.java
  
  Index: ReturnaddressType.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/generic/ReturnaddressType.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ReturnaddressType.java	29 Oct 2001 20:00:26 -0000	1.1
  +++ ReturnaddressType.java	28 Jul 2003 07:04:41 -0000	1.2
  @@ -90,7 +90,12 @@
       if(!(rat instanceof ReturnaddressType))
         return false;
   
  -    return ((ReturnaddressType)rat).returnTarget.equals(this.returnTarget);
  +		ReturnaddressType that = (ReturnaddressType)rat;
  +		
  +		if(this.returnTarget == null || that.returnTarget == null)
  +			return that.returnTarget == this.returnTarget;
  +		
  +    return that.returnTarget.equals(this.returnTarget);
     }	
   
     /**
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.