From c51f442c8c33d4d171adf6c5875cbfc7a9e1d1eb Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Fri, 19 Apr 2019 10:13:53 +0100 Subject: [PATCH] Forbid empty custom property values sass-spec: https://github.com/sass/sass-spec/pull/1385 Fixes #2655 --- src/expand.cpp | 8 +++++++- src/parser.cpp | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/expand.cpp b/src/expand.cpp index 0a40410ed4..bb1fab4baa 100644 --- a/src/expand.cpp +++ b/src/expand.cpp @@ -253,7 +253,13 @@ namespace Sass { if (value) value = value->perform(&eval); Block_Obj bb = ab ? operator()(ab) : NULL; if (!bb) { - if (!value || (value->is_invisible() && !d->is_important())) return 0; + if (!value || (value->is_invisible() && !d->is_important())) { + if (d->is_custom_property()) { + error("Custom property values may not be empty.", d->value()->pstate(), traces); + } else { + return nullptr; + } + } } Declaration* decl = SASS_MEMORY_NEW(Declaration, d->pstate(), diff --git a/src/parser.cpp b/src/parser.cpp index 2afd12cc3c..a697d20c01 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -1859,7 +1859,7 @@ namespace Sass { css_error("Invalid CSS", " after ", message); } - if (schema->empty()) return {}; + if (schema->empty()) error("Custom property values may not be empty."); return schema.detach(); }