Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2017-01-20 01:45:39 -0500
committerGerrit Code Review @ Eclipse.org2017-01-28 14:42:11 -0500
commit1703112285e19de1ad66989f40b7c16146e36390 (patch)
tree2a2fc45a4d5d706459fb047c46bf2ae28c6a926a
parent0dd5bb0f651ea89bcfcf742310c4ef133b9fb99c (diff)
downloadorg.eclipse.cdt-1703112285e19de1ad66989f40b7c16146e36390.tar.gz
org.eclipse.cdt-1703112285e19de1ad66989f40b7c16146e36390.tar.xz
org.eclipse.cdt-1703112285e19de1ad66989f40b7c16146e36390.zip
Bug 510722 - Handle a null AST in ExpandSelectionJob and ControlFlowGraphView
-rw-r--r--codan/org.eclipse.cdt.codan.ui.cfgview/src/org/eclipse/cdt/codan/ui/cfgview/views/ControlFlowGraphView.java3
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/StructureSelectionAction.java5
2 files changed, 7 insertions, 1 deletions
diff --git a/codan/org.eclipse.cdt.codan.ui.cfgview/src/org/eclipse/cdt/codan/ui/cfgview/views/ControlFlowGraphView.java b/codan/org.eclipse.cdt.codan.ui.cfgview/src/org/eclipse/cdt/codan/ui/cfgview/views/ControlFlowGraphView.java
index 11d393da2c..db2ec904de 100644
--- a/codan/org.eclipse.cdt.codan.ui.cfgview/src/org/eclipse/cdt/codan/ui/cfgview/views/ControlFlowGraphView.java
+++ b/codan/org.eclipse.cdt.codan.ui.cfgview/src/org/eclipse/cdt/codan/ui/cfgview/views/ControlFlowGraphView.java
@@ -300,6 +300,9 @@ public class ControlFlowGraphView extends ViewPart {
Job job = new SharedASTJob("Building Control Flow Grath", tu) {
@Override
public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) throws CoreException {
+ if (ast == null) {
+ return Status.CANCEL_STATUS;
+ }
processAst(ast);
return Status.OK_STATUS;
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/StructureSelectionAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/StructureSelectionAction.java
index 13f1aca43d..a0c40bef3a 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/StructureSelectionAction.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/StructureSelectionAction.java
@@ -56,7 +56,10 @@ public abstract class StructureSelectionAction extends TextEditorAction {
@Override
public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) throws CoreException {
- newSourceRange = doExpand(ast,currentSourceRange);
+ if (ast == null) {
+ return Status.CANCEL_STATUS;
+ }
+ newSourceRange = doExpand(ast, currentSourceRange);
return Status.OK_STATUS;
}
}

Back to the top