Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] CDT/Core null pointer fix.

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/ChangeLog,v
retrieving revision 1.133
diff -u -r1.133 ChangeLog
--- ChangeLog	28 Aug 2003 15:50:31 -0000	1.133
+++ ChangeLog	28 Aug 2003 19:15:51 -0000
@@ -1,3 +1,9 @@
+2003-08-28 Alain Magloire
+
+	Change the TranslationUnit to not always assume that it has a valid
+	IResource/IFile.
+	* model/org/eclipse/cdt/internal/core/model/TranslationUnit.java
+
 2003-08-28 Hoda Amer
 	- Added resolving references in a method's qualified name 
 	in Complete parse mode.
Index: model/org/eclipse/cdt/internal/core/model/TranslationUnit.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java,v
retrieving revision 1.10
diff -u -r1.10 TranslationUnit.java
--- model/org/eclipse/cdt/internal/core/model/TranslationUnit.java	12 Aug 2003 20:20:04 -0000	1.10
+++ model/org/eclipse/cdt/internal/core/model/TranslationUnit.java	28 Aug 2003 19:15:51 -0000
@@ -334,7 +334,10 @@
 		if (isWorkingCopy()) {
 			ITranslationUnit original = (ITranslationUnit) ((IWorkingCopy)this).getOriginalElement();
 			// might be IResource.NULL_STAMP if original does not exist
-			unitInfo.fTimestamp = ((IFile) original.getResource()).getModificationStamp();
+			IResource r = original.getResource();
+			if (r != null && r instanceof  IFile) {
+				unitInfo.fTimestamp = ((IFile) r).getModificationStamp();
+			}
 		}
 		
 		return unitInfo.isStructureKnown();



Back to the top