From 792bb2df1c9e192526568af8c05264a93be2c0b5 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Mon, 16 Oct 2023 16:58:17 +0300 Subject: [PATCH] Kernel: TTY doesn't panic if it doesn't find input device --- kernel/kernel/Terminal/TTY.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel/kernel/Terminal/TTY.cpp b/kernel/kernel/Terminal/TTY.cpp index de2ed755..fd370573 100644 --- a/kernel/kernel/Terminal/TTY.cpp +++ b/kernel/kernel/Terminal/TTY.cpp @@ -81,7 +81,14 @@ namespace Kernel Process::create_kernel( [](void*) { - auto inode = MUST(VirtualFileSystem::get().file_from_absolute_path({ 0, 0, 0, 0 }, "/dev/input0"sv, O_RDONLY)).inode; + auto file_or_error = VirtualFileSystem::get().file_from_absolute_path({ 0, 0, 0, 0 }, "/dev/input0"sv, O_RDONLY); + if (file_or_error.is_error()) + { + dprintln("no input device found"); + return; + } + + auto inode = file_or_error.value().inode; while (true) { while (!TTY::current()->m_tty_ctrl.receive_input)