From d383a342aaa001439d59cb09d3a86ca3c54f8713 Mon Sep 17 00:00:00 2001
From: Jorge Gorbe Moya <jgorbe@google.com>
Date: Wed, 13 Mar 2019 23:50:35 +0000
Subject: [PATCH] [lldb-vscode] Don't try to launch an invalid program.

If an invalid program is specified, lldb-vscode will send back a
response with "success" = false, but then will continue executing the
rest of request_launch(), try to launch the program anyway and try to
send another response (possibly using the `response` object after it was
moved).

This change adds a return statement so we stop executing the handler
after producing the first failing response.

Differential Revision: https://reviews.llvm.org/D59340

llvm-svn: 356110
---
 lldb/tools/lldb-vscode/lldb-vscode.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp b/lldb/tools/lldb-vscode/lldb-vscode.cpp
index 3aed079e3f43..1fbcd2ee0892 100644
--- a/lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -1245,6 +1245,7 @@ void request_launch(const llvm::json::Object &request) {
           response, "message",
           llvm::formatv("Could not load program '{0}'.", program).str());
       g_vsc.SendJSON(llvm::json::Value(std::move(response)));
+      return;
     }
   }