Skip to content

Commit

Permalink
Merge pull request #1887 from xzyfer/fix/issue-1886
Browse files Browse the repository at this point in the history
Fix segfault with url()
  • Loading branch information
xzyfer committed Jan 20, 2016
2 parents bc1e6db + 189de57 commit 20bfdbc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1773,14 +1773,19 @@ namespace Sass {
suffix = std::string(lexed);
}

std::string uri("");
if (url_string) {
uri = url_string->to_string({ NESTED, 5 });
}

if (String_Schema* schema = dynamic_cast<String_Schema*>(url_string)) {
String_Schema* res = SASS_MEMORY_NEW(ctx.mem, String_Schema, pstate);
(*res) << SASS_MEMORY_NEW(ctx.mem, String_Constant, pstate, prefix);
(*res) += schema;
(*res) << SASS_MEMORY_NEW(ctx.mem, String_Constant, pstate, suffix);
return res;
} else {
std::string res = prefix + url_string->to_string({ NESTED, 5 }) + suffix;
std::string res = prefix + uri + suffix;
return SASS_MEMORY_NEW(ctx.mem, String_Constant, pstate, res);
}
}
Expand Down

0 comments on commit 20bfdbc

Please sign in to comment.