fix bug 10386 (mrege from CDT 6.0.1 HEAD) RCL_2_4
authortimkelly
Tue, 15 Dec 2009 14:30:07 -0600
branchRCL_2_4
changeset 128 d00b6e7a8c94
parent 108 177481f2140d
child 132 3720b50bf185
fix bug 10386 (mrege from CDT 6.0.1 HEAD)
cdt/cdt_6_0_x/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsJob.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsJob.java	Wed Nov 04 15:14:56 2009 -0600
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsJob.java	Tue Dec 15 14:30:07 2009 -0600
@@ -377,12 +377,17 @@
 	}
 
 	private boolean isSameName(IName n1, IName n2) {
+		if (n1 == n2)
+			return true;
+
 		IASTFileLocation loc1 = n1.getFileLocation();
 		IASTFileLocation loc2 = n2.getFileLocation();
-		return loc1.getFileName().equals(loc2.getFileName()) &&
-				loc1.getNodeOffset() == loc2.getNodeOffset() &&
-				loc1.getNodeLength() == loc2.getNodeLength();
-	}
+		if (loc1 == null || loc2 == null) {
+			return false;
+		}
+		return loc1.getFileName().equals(loc2.getFileName()) 
+				&& loc1.getNodeOffset() == loc2.getNodeOffset()
+				&& loc1.getNodeLength() == loc2.getNodeLength();}
 
 	private static boolean isInSameFunction(IASTName name1, IName name2) {
 		IASTDeclaration decl1 = getEnclosingDeclaration(name1);