From 353da56cc62bee531cc44e764f3b8f495b135ab1 Mon Sep 17 00:00:00 2001 From: Kyo Nagashima Date: Sat, 18 Oct 2014 23:30:00 +0900 Subject: [PATCH] Don't convert a color if parsing failed See #39. This does not fix completely, but suppress an runtime error. --- lib/csswring.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/csswring.js b/lib/csswring.js index 76c8fb9..78acde1 100644 --- a/lib/csswring.js +++ b/lib/csswring.js @@ -48,6 +48,11 @@ var unquoteFontFamily = function (family) { var toRGBColor = function (m, leading, color) { color = onecolor(color); + // one.color failed to parse `color` + if (!color) { + return m; + } + if (color.alpha() < 1) { return leading + color.cssa(); }