1
0
Fork 0

work around unexcepted start/end values from V8

This commit is contained in:
jsteemann 2016-11-03 17:02:05 +01:00
parent 2fdaca29df
commit b2c04f6165
2 changed files with 9 additions and 2 deletions

View File

@ -43,7 +43,7 @@ static Completer* COMPLETER = nullptr;
static void LinenoiseCompletionGenerator(char const* text,
linenoiseCompletions* lc) {
if (COMPLETER) {
if (COMPLETER && text != nullptr) {
std::vector<std::string> alternatives = COMPLETER->alternatives(text);
ShellBase::sortAlternatives(alternatives);

View File

@ -3925,7 +3925,14 @@ std::string TRI_StringifyV8Exception(v8::Isolate* isolate,
l = "";
}
l += std::string((size_t)(end - start + 1), '^');
// in fact, we observed start being greater than end sometimes...
// this does not make sense and seems to be a bug in V8, but it happens
// so we need to work around this
if (end >= start) {
l += std::string((size_t)(end - start + 1), '^');
} else {
l = "^";
}
result += "!" + l + "\n";
}