Skip to content

Commit

Permalink
Forbid empty custom property values
Browse files Browse the repository at this point in the history
sass-spec: sass/sass-spec#1385
Fixes #2655
  • Loading branch information
glebm committed Apr 20, 2019
1 parent f2db048 commit c51f442
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/expand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit c51f442

Please sign in to comment.