Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2004-12-14 17:31:43 -0500
committerAlain Magloire2004-12-14 17:31:43 -0500
commit7ed140001420f9bcf04a10a46171ef9fa28d9e0b (patch)
treea035b6baf7e72eafad45438d7110b37159da20d8
parent587143e977126fe2db3d94192b440e9d0b9e395d (diff)
downloadorg.eclipse.cdt-7ed140001420f9bcf04a10a46171ef9fa28d9e0b.tar.gz
org.eclipse.cdt-7ed140001420f9bcf04a10a46171ef9fa28d9e0b.tar.xz
org.eclipse.cdt-7ed140001420f9bcf04a10a46171ef9fa28d9e0b.zip
Fix for 81007 NPE
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileTextHover.java46
1 files changed, 24 insertions, 22 deletions
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileTextHover.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileTextHover.java
index b1c61a40e1..babfd03cd9 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileTextHover.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileTextHover.java
@@ -54,31 +54,33 @@ public class MakefileTextHover implements ITextHover {
if (fEditor != null && len > -1) {
IWorkingCopyManager fManager = MakeUIPlugin.getDefault().getWorkingCopyManager();
IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput());
- WordPartDetector wordPart = new WordPartDetector(textViewer, offset);
- String name = wordPart.toString();
- IMacroDefinition[] statements = null;
- if (WordPartDetector.inMacro(textViewer, offset)) {
- statements = makefile.getMacroDefinitions(name);
- if (statements == null || statements.length == 0) {
- statements = makefile.getBuiltinMacroDefinitions(name);
+ if (makefile != null) {
+ WordPartDetector wordPart = new WordPartDetector(textViewer, offset);
+ String name = wordPart.toString();
+ IMacroDefinition[] statements = null;
+ if (WordPartDetector.inMacro(textViewer, offset)) {
+ statements = makefile.getMacroDefinitions(name);
+ if (statements == null || statements.length == 0) {
+ statements = makefile.getBuiltinMacroDefinitions(name);
+ }
}
- }
-
- if (statements == null) {
- statements = new IMacroDefinition[0];
- }
- // iterate over all the different categories
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < statements.length; i++) {
- if (i > 0) {
- buffer.append("\n"); //$NON-NLS-1$
+
+ if (statements == null) {
+ statements = new IMacroDefinition[0];
+ }
+ // iterate over all the different categories
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < statements.length; i++) {
+ if (i > 0) {
+ buffer.append("\n"); //$NON-NLS-1$
+ }
+ String infoString = statements[i].getValue().toString();
+ buffer.append(name);
+ buffer.append(" - "); //$NON-NLS-1$
+ buffer.append(infoString);
}
- String infoString = statements[i].getValue().toString();
- buffer.append(name);
- buffer.append(" - "); //$NON-NLS-1$
- buffer.append(infoString);
+ return buffer.toString();
}
- return buffer.toString();
}
} catch (BadLocationException e) {
}

Back to the top