From 416254a20995e86abd60a4d290b4e523252eb5c3 Mon Sep 17 00:00:00 2001
From: jean_patrick_mathes <uomnk@student.kit.edu>
Date: Thu, 8 Sep 2022 13:09:34 +0200
Subject: [PATCH] Handle missing executable and exec failure

---
 .../applications/ArmarXGui/ArmarXMainWindow.cpp       | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/source/ArmarXGui/applications/ArmarXGui/ArmarXMainWindow.cpp b/source/ArmarXGui/applications/ArmarXGui/ArmarXMainWindow.cpp
index c78239e6..777cf9e5 100644
--- a/source/ArmarXGui/applications/ArmarXGui/ArmarXMainWindow.cpp
+++ b/source/ArmarXGui/applications/ArmarXGui/ArmarXMainWindow.cpp
@@ -1315,6 +1315,16 @@ namespace armarx
 
         auto slot = [action, this, binaryPath]()
         {
+            if (not std::filesystem::exists(binaryPath))
+            {
+                QMessageBox errorBox;
+                errorBox.critical(nullptr, "Error", "The ArViz Godot executable is no longer available.");
+
+                ARMARX_ERROR << "Failed to find ArViz Godot";
+
+                return;
+            }
+
             pid_t pid = fork();
 
             if (pid == -1)
@@ -1333,6 +1343,7 @@ namespace armarx
             dup2(null, STDERR_FILENO);
 
             execl(binaryPath.c_str(), "arviz-godot", nullptr);
+            exit(-1);
         };
 
         connect(action, &QAction::triggered, this, slot, Qt::UniqueConnection);
-- 
GitLab