Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Fix for NPE in findTranslation unit for relative elf file references

Hi CDT people, here is a patch that avoids a horribly ugly NPE in the ui
when handling some elf files.



Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/ChangeLog,v
retrieving revision 1.155
diff -u -r1.155 ChangeLog
--- ChangeLog	26 Sep 2003 17:53:31 -0000	1.155
+++ ChangeLog	1 Oct 2003 09:25:01 -0000
@@ -1,3 +1,7 @@
+2003-10-01 Rob Jackson
+
+	avoid a NPE when processing non-absolute FILE references in elf
binaries
+
 2003-09-25 Bogdan Gheorghe
 
 	- Got rid of refs to old dependency service; restructured
Index: model/org/eclipse/cdt/internal/core/model/BinaryElement.java
===================================================================
RCS file:
/home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/mod
el/BinaryElement.java,v
retrieving revision 1.3
diff -u -r1.3 BinaryElement.java
--- model/org/eclipse/cdt/internal/core/model/BinaryElement.java
2 Apr 2003 04:52:40 -0000	1.3
+++ model/org/eclipse/cdt/internal/core/model/BinaryElement.java
1 Oct 2003 09:25:01 -0000
@@ -113,6 +113,7 @@
 					}
 				}
 			} else {
+				//TODO handle non-absolute paths when
finding source files (gdb searchdirs ?) 
 				// ??? assert()
 				path = new Path("");
 			}
@@ -121,7 +122,10 @@
 				ICProject cproject = getCProject();
 				SourceMapper mapper =
mgr.getSourceMapper(cproject);
 				if (mapper != null) {
-					tu =
mapper.findTranslationUnit(path.lastSegment());
+					String lastSeg =
path.lastSegment();
+					if (lastSeg != null) {
+						tu =
mapper.findTranslationUnit(path.lastSegment());
+					}
 				}
 			}
 		}


Back to the top