Skip to content

Commit

Permalink
Don't try to get an AST if there is no source (issue 8)
Browse files Browse the repository at this point in the history
  • Loading branch information
chookapp committed Nov 3, 2012
1 parent b01d32d commit 3a2a7df
Showing 1 changed file with 12 additions and 0 deletions.
Expand Up @@ -11,6 +11,7 @@
package com.chookapp.org.bracketeer.jdt;

import org.eclipse.jdt.core.ITypeRoot;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.CompilationUnit;
Expand Down Expand Up @@ -82,6 +83,17 @@ private void processAst(IDocument doc, IBracketeerProcessingContainer container)
if( _typeRoot == null )
return;

// can happen if this is a "classFile" without attached source...
try
{
if(_typeRoot.getSource() == null)
return;
}
catch (JavaModelException e)
{
return;
}

ASTParser astp = ASTParser.newParser(AST.JLS3);
astp.setSource(_typeRoot);
astp.setResolveBindings(false);
Expand Down

0 comments on commit 3a2a7df

Please sign in to comment.