Skip to content

Commit 20bfdbc

Browse files
committed
Merge pull request #1887 from xzyfer/fix/issue-1886
Fix segfault with url()
2 parents bc1e6db + 189de57 commit 20bfdbc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/parser.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1773,14 +1773,19 @@ namespace Sass {
17731773
suffix = std::string(lexed);
17741774
}
17751775

1776+
std::string uri("");
1777+
if (url_string) {
1778+
uri = url_string->to_string({ NESTED, 5 });
1779+
}
1780+
17761781
if (String_Schema* schema = dynamic_cast<String_Schema*>(url_string)) {
17771782
String_Schema* res = SASS_MEMORY_NEW(ctx.mem, String_Schema, pstate);
17781783
(*res) << SASS_MEMORY_NEW(ctx.mem, String_Constant, pstate, prefix);
17791784
(*res) += schema;
17801785
(*res) << SASS_MEMORY_NEW(ctx.mem, String_Constant, pstate, suffix);
17811786
return res;
17821787
} else {
1783-
std::string res = prefix + url_string->to_string({ NESTED, 5 }) + suffix;
1788+
std::string res = prefix + uri + suffix;
17841789
return SASS_MEMORY_NEW(ctx.mem, String_Constant, pstate, res);
17851790
}
17861791
}

0 commit comments

Comments
 (0)