From dcb8c4f174283da7bf12110320f79f4bf49e52a4 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Tue, 22 Dec 2015 11:12:16 +0100 Subject: [PATCH] prevent segfault --- arangosh/V8Client/arangosh.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/arangosh/V8Client/arangosh.cpp b/arangosh/V8Client/arangosh.cpp index fab41ac7ff..e48544454a 100644 --- a/arangosh/V8Client/arangosh.cpp +++ b/arangosh/V8Client/arangosh.cpp @@ -1640,8 +1640,10 @@ static void RunShell (v8::Isolate* isolate, v8::Handle context, boo // this will change the prompt for the next round promptError = true; } - - ClientConnection->setInterrupted(false); + + if (ClientConnection) { + ClientConnection->setInterrupted(false); + } BaseClient.stopPager(); BaseClient.printLine(""); @@ -2038,7 +2040,9 @@ static bool PrintHelo (bool useServer) { BaseClient.printWelcomeInfo(); if (useServer) { - if (ClientConnection->isConnected() && ClientConnection->getLastHttpReturnCode() == HttpResponse::OK) { + if (ClientConnection && + ClientConnection->isConnected() && + ClientConnection->getLastHttpReturnCode() == HttpResponse::OK) { ostringstream is; is << "Connected to ArangoDB '" << BaseClient.endpointString() << "' version: " << ClientConnection->getVersion() @@ -2054,7 +2058,8 @@ static bool PrintHelo (bool useServer) { << "', username: '" << BaseClient.username() << "'"; BaseClient.printErrLine(is.str()); - if (ClientConnection->getErrorMessage() != "") { + if (ClientConnection && + ClientConnection->getErrorMessage() != "") { ostringstream is2; is2 << "Error message '" << ClientConnection->getErrorMessage() << "'"; BaseClient.printErrLine(is2.str());