Fix double-destruct of string on syntax error

Reviewed By: davidaurelio

Differential Revision: D2939260

fb-gh-sync-id: b080b70aae7e33297d549d387e40bde07f4fc765
shipit-source-id: b080b70aae7e33297d549d387e40bde07f4fc765
This commit is contained in:
Andy Street 2016-02-16 10:07:35 -08:00 committed by facebook-github-bot-9
parent 027f26df57
commit e1fed608e8
1 changed files with 1 additions and 1 deletions

View File

@ -55,7 +55,7 @@ JSValueRef evaluateScript(JSContextRef context, JSStringRef script, JSStringRef
auto line = exception.asObject().getProperty("line"); auto line = exception.asObject().getProperty("line");
std::ostringstream locationInfo; std::ostringstream locationInfo;
std::string file = source != nullptr ? String::adopt(source).str() : ""; std::string file = source != nullptr ? String::ref(source).str() : "";
locationInfo << "(" << (file.length() ? file : "<unknown file>"); locationInfo << "(" << (file.length() ? file : "<unknown file>");
if (line != nullptr && line.isNumber()) { if (line != nullptr && line.isNumber()) {
locationInfo << ":" << line.asInteger(); locationInfo << ":" << line.asInteger();