From e91a9f5de557ce802a08cdea43bb51cae638f8bf Mon Sep 17 00:00:00 2001 From: Andrew Niefer Date: Tue, 5 Jul 2005 19:32:19 +0000 Subject: [PATCH] fix bug 102732 : NPE in CPPSemantics.getLookupScope modified from Devin's patch --- .../cdt/internal/core/dom/parser/cpp/CPPSemantics.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java index efd5680d14b..fe13c2ac0cb 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java @@ -958,8 +958,10 @@ public class CPPSemantics { ICPPScope scope = null; if( start instanceof ICPPScope ) scope = (ICPPScope) start; - else + else if( start instanceof IASTName ) scope = getLookupScope( (IASTName) start ); + else + return; boolean friendInLocalClass = false; if( scope instanceof ICPPClassScope && data.forFriendship() ){ @@ -3091,6 +3093,9 @@ public class CPPSemantics { } catch (DOMException e1) { return null; } + if( scope == null ) + return null; + CPPASTName astName = new CPPASTName(); astName.setParent( exp ); astName.setPropertyInParent( STRING_LOOKUP_PROPERTY );