diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog index c59f4f9c6b7..2a61cdfd718 100644 --- a/core/org.eclipse.cdt.ui/ChangeLog +++ b/core/org.eclipse.cdt.ui/ChangeLog @@ -1,3 +1,10 @@ +2004-07-06 Chris Wiebe + + This patch prevents some NPEs from happening in the class browser. I + suggest this should be applied to both HEAD and CDT_2_0 branch. + + * src/org/eclipse/cdt/internal/ui/viewsupport/CElementLabels.java + 2004-07-06 Hoda Amer Fix for PR 69330 : Outline is flickering. diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CElementLabels.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CElementLabels.java index e33d8ba7e19..a400dab5434 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CElementLabels.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CElementLabels.java @@ -326,8 +326,11 @@ public class CElementLabels { //qualification if( getFlag( flags, M_FULLY_QUALIFIED ) ){ - getTypeLabel( method.getParent(), T_FULLY_QUALIFIED | (flags & P_COMPRESSED), buf ); - buf.append( "::" ); //$NON-NLS-1$ + ICElement parent = method.getParent(); + if (parent != null && parent.exists()) { + getTypeLabel( parent, T_FULLY_QUALIFIED | (flags & P_COMPRESSED), buf ); + buf.append( "::" ); //$NON-NLS-1$ + } } buf.append( method.getElementName() ); @@ -455,9 +458,11 @@ public class CElementLabels { public static void getTypeLabel(ICElement elem, int flags, StringBuffer buf) { if (getFlag(flags, T_FULLY_QUALIFIED)) { ISourceRoot root= CModelUtil.getSourceRoot(elem); - getSourceRootLabel(root, (flags & P_COMPRESSED), buf); - buf.append(root.getElementName()); - buf.append('.'); + if (root != null) { + getSourceRootLabel(root, (flags & P_COMPRESSED), buf); + buf.append(root.getElementName()); + buf.append('.'); + } } String typeName= elem.getElementName();