summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSalvador Zalapa2013-06-03 15:37:38 (EDT)
committerNick Sandonato2013-06-11 11:12:11 (EDT)
commitc2a3f9985620a58ce2779985ed47972bcebeb17a (patch)
treec9b2f5e91db3eb6d6131cb354103609949d9f75e
parent9f255bd34938f06593c1f1573841a9d605429dd7 (diff)
downloadwebtools.sourceediting-c2a3f9985620a58ce2779985ed47972bcebeb17a.zip
webtools.sourceediting-c2a3f9985620a58ce2779985ed47972bcebeb17a.tar.gz
webtools.sourceediting-c2a3f9985620a58ce2779985ed47972bcebeb17a.tar.bz2
[409674] NPE is thrown while trying to format an internal CSS
-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 2590d33..4bd509d 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);