From 4be5000c22a0cb1d7201f01a1c851783170ad2e2 Mon Sep 17 00:00:00 2001 From: Caoimhe Date: Sat, 3 Jun 2023 00:16:59 +0100 Subject: [PATCH] SpiceAgent: Exit early if `SPICE_DEVICE` doesn't exist --- Userland/Services/SpiceAgent/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Userland/Services/SpiceAgent/main.cpp b/Userland/Services/SpiceAgent/main.cpp index 111c6b78d36..a8520ef2b29 100644 --- a/Userland/Services/SpiceAgent/main.cpp +++ b/Userland/Services/SpiceAgent/main.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -20,6 +21,10 @@ static constexpr auto SPICE_DEVICE = "/dev/hvc0p1"sv; ErrorOr serenity_main(Main::Arguments arguments) { + if (!FileSystem::exists(SPICE_DEVICE)) { + return Error::from_string_literal("Failed to find spice device file!"); + } + // We use the application to be able to easily write to the user's clipboard. auto app = TRY(GUI::Application::create(arguments));