From db8b15aacf289485a219e5bd92ea8f6e4fcc3e17 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Tue, 2 Sep 2008 11:15:55 +0000 Subject: [PATCH] NPE invoking rename refactoring, bug 244866. --- .../ui/refactoring/rename/ASTManager.java | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/ASTManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/ASTManager.java index f5b7f1e2ace..801d7cfeb78 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/ASTManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/ASTManager.java @@ -822,21 +822,23 @@ public class ASTManager { pm.worked(1); if (tu != null) { IASTName name= tu.getNodeSelector(tu.getFilePath()).findEnclosingName(fArgument.getOffset(), fArgument.getLength()); - if (name instanceof ICPPASTQualifiedName) { - IASTName[] na= ((ICPPASTQualifiedName) name).getNames(); - name= na[na.length-1]; - } - fArgument.setName(name); - IBinding binding= name.resolveBinding(); - if (binding != null) { - IScope scope= null; - try { - scope = binding.getScope(); - } catch (DOMException e) { - handleDOMException(tu, e, status); - } - fArgument.setBinding(name.getTranslationUnit(), binding, scope); - } + if (name != null) { + if (name instanceof ICPPASTQualifiedName) { + IASTName[] na= ((ICPPASTQualifiedName) name).getNames(); + name= na[na.length-1]; + } + fArgument.setName(name); + IBinding binding= name.resolveBinding(); + if (binding != null) { + IScope scope= null; + try { + scope = binding.getScope(); + } catch (DOMException e) { + handleDOMException(tu, e, status); + } + fArgument.setBinding(name.getTranslationUnit(), binding, scope); + } + } } pm.worked(1); pm.done();