Browse Source

Prevent NPE when a SCSS file is not found #11099

Change-Id: Id0e0fd6a31f4089228b02bf8b66086d3f3a1727b
tags/7.0.2
John Ahlroos 11 years ago
parent
commit
b056c43954

+ 7
- 0
theme-compiler/src/com/vaadin/sass/SassCompiler.java View File

@@ -17,6 +17,7 @@
package com.vaadin.sass;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;

@@ -48,6 +49,12 @@ public class SassCompiler {
// ScssStylesheet.setStylesheetResolvers(new VaadinResolver());

ScssStylesheet scss = ScssStylesheet.get(input);
if(scss == null){
System.err.println("The scss file " + input
+ " could not be found.");
return;
}
scss.compile();
if (output == null) {
System.out.println(scss.toString());

+ 10
- 2
theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java View File

@@ -78,7 +78,8 @@ public class ScssStylesheet extends Node {
* ScssStylesheet tree out of it. Calling compile() on it will transform
* SASS into CSS. Calling toString() will print out the SCSS/CSS.
*
* @param file
* @param identifier
* The file path. If null then null is returned.
* @return
* @throws CSSException
* @throws IOException
@@ -93,7 +94,8 @@ public class ScssStylesheet extends Node {
* builds up a ScssStylesheet tree out of it. Calling compile() on it will
* transform SASS into CSS. Calling toString() will print out the SCSS/CSS.
*
* @param file
* @param identifier
* The file path. If null then null is returned.
* @param encoding
* @return
* @throws CSSException
@@ -109,6 +111,12 @@ public class ScssStylesheet extends Node {
*
* @charset declaration, the default one is ASCII.
*/

if (identifier == null) {
return null;
}

// FIXME Is this actually intended? /John 1.3.2013
File file = new File(identifier);
file = file.getCanonicalFile();


Loading…
Cancel
Save