mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 01:36:01 +02:00
Fixed an NPE.
This commit is contained in:
parent
35a57ae158
commit
0cecd403cb
1 changed files with 2 additions and 0 deletions
|
@ -116,6 +116,8 @@ public final class CxxAstUtils {
|
||||||
public static boolean isInMacro(IASTNode node) {
|
public static boolean isInMacro(IASTNode node) {
|
||||||
IASTNodeSelector nodeSelector = node.getTranslationUnit().getNodeSelector(node.getTranslationUnit().getFilePath());
|
IASTNodeSelector nodeSelector = node.getTranslationUnit().getNodeSelector(node.getTranslationUnit().getFilePath());
|
||||||
IASTFileLocation fileLocation = node.getFileLocation();
|
IASTFileLocation fileLocation = node.getFileLocation();
|
||||||
|
if (fileLocation == null)
|
||||||
|
return true;
|
||||||
IASTPreprocessorMacroExpansion macro = nodeSelector.findEnclosingMacroExpansion(fileLocation.getNodeOffset(),
|
IASTPreprocessorMacroExpansion macro = nodeSelector.findEnclosingMacroExpansion(fileLocation.getNodeOffset(),
|
||||||
fileLocation.getNodeLength());
|
fileLocation.getNodeLength());
|
||||||
return macro != null;
|
return macro != null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue