From 1d508cd878f9424b4afca77661ea32c270a15c8b Mon Sep 17 00:00:00 2001 From: David Daoust Date: Fri, 18 Aug 2006 17:44:10 +0000 Subject: [PATCH] Fix for 154350 --- .../editor/CSourceViewerDecorationSupport.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CSourceViewerDecorationSupport.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CSourceViewerDecorationSupport.java index ad5a1f0ec79..16e628d4272 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CSourceViewerDecorationSupport.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CSourceViewerDecorationSupport.java @@ -12,6 +12,7 @@ package org.eclipse.cdt.internal.ui.editor; import java.util.ArrayList; import java.util.Collections; +import java.util.EmptyStackException; import java.util.Iterator; import java.util.List; import java.util.Stack; @@ -504,13 +505,16 @@ public class CSourceViewerDecorationSupport } } else if (statement instanceof IASTPreprocessorEndifStatement) { IASTPreprocessorEndifStatement endifStmt = (IASTPreprocessorEndifStatement)statement; - boolean wasInInactiveCode = ((Boolean)inactiveCodeStack.pop()).booleanValue(); - if (inInactiveCode && !wasInInactiveCode) { - IASTNodeLocation nodeLocation = endifStmt.getNodeLocations()[0]; - int inactiveCodeEnd = nodeLocation.getNodeOffset() + nodeLocation.getNodeLength(); - positions.add(new ReusableRegion(inactiveCodeStart, inactiveCodeEnd - inactiveCodeStart)); + try { + boolean wasInInactiveCode = ((Boolean)inactiveCodeStack.pop()).booleanValue(); + if (inInactiveCode && !wasInInactiveCode) { + IASTNodeLocation nodeLocation = endifStmt.getNodeLocations()[0]; + int inactiveCodeEnd = nodeLocation.getNodeOffset() + nodeLocation.getNodeLength(); + positions.add(new ReusableRegion(inactiveCodeStart, inactiveCodeEnd - inactiveCodeStart)); + } + inInactiveCode = wasInInactiveCode; } - inInactiveCode = wasInInactiveCode; + catch( EmptyStackException e) {} } } if (inInactiveCode) {