Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AbstractCSSSourceFormatter.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AbstractCSSSourceFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AbstractCSSSourceFormatter.java
index 2590d33c90..4bd509dc0f 100644
--- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AbstractCSSSourceFormatter.java
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AbstractCSSSourceFormatter.java
@@ -83,16 +83,18 @@ public abstract class AbstractCSSSourceFormatter implements CSSSourceGenerator {
int[] result = null;
if (prev == null || (prev.getType() == CSSRegionContexts.CSS_S && (result = TextUtilities.indexOf(DefaultLineTracker.DELIMITERS, it.getStructuredDocumentRegion().getText(prev), 0))[0] >= 0)) {
// Collapse to one empty line if there's more than one.
- int offset = result[0] + DefaultLineTracker.DELIMITERS[result[1]].length();
- if (offset < it.getStructuredDocumentRegion().getText(prev).length() ) {
- if (TextUtilities.indexOf(DefaultLineTracker.DELIMITERS, it.getStructuredDocumentRegion().getText(prev), offset)[0] >= 0) {
- source.append(delim);
+ if (result != null){
+ int offset = result[0] + DefaultLineTracker.DELIMITERS[result[1]].length();
+ if (offset < it.getStructuredDocumentRegion().getText(prev).length() ) {
+ if (TextUtilities.indexOf(DefaultLineTracker.DELIMITERS, it.getStructuredDocumentRegion().getText(prev), offset)[0] >= 0) {
+ source.append(delim);
+ }
}
+ source.append(delim);
+ source.append(getIndent(node));
+ if (needIndent)
+ source.append(getIndentString());
}
- source.append(delim);
- source.append(getIndent(node));
- if (needIndent)
- source.append(getIndentString());
}
else if (prev.getType() == CSSRegionContexts.CSS_COMMENT) {
String fullText = toAppend.getDocumentRegion().getFullText(prev);

Back to the top