diff options
author | Jean-Baptiste Boric <jblbeurope@gmail.com> | 2021-01-24 19:15:13 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-24 22:16:18 +0100 |
commit | 491a67ddc496a188ca9f31e976884de75f23c074 (patch) | |
tree | e83106df8ca94764ad284ea9ccca4fb97ba5a4a5 /Userland | |
parent | 4d755725bf1228fbd930d02a69c21b3e5c755881 (diff) | |
download | serenity-491a67ddc496a188ca9f31e976884de75f23c074.zip |
WindowServer: Don't crash if unable to open input peripherals
Seems a bit extreme, other operating systems don't have their graphical
environment crash if there is no keyboard or no mouse.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Services/WindowServer/EventLoop.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/Userland/Services/WindowServer/EventLoop.cpp b/Userland/Services/WindowServer/EventLoop.cpp index 21dae58823..b8fdfcc3be 100644 --- a/Userland/Services/WindowServer/EventLoop.cpp +++ b/Userland/Services/WindowServer/EventLoop.cpp @@ -66,14 +66,19 @@ EventLoop::EventLoop() IPC::new_client_connection<ClientConnection>(client_socket.release_nonnull(), client_id); }; - ASSERT(m_keyboard_fd >= 0); - ASSERT(m_mouse_fd >= 0); - - m_keyboard_notifier = Core::Notifier::construct(m_keyboard_fd, Core::Notifier::Read); - m_keyboard_notifier->on_ready_to_read = [this] { drain_keyboard(); }; + if (m_keyboard_fd >= 0) { + m_keyboard_notifier = Core::Notifier::construct(m_keyboard_fd, Core::Notifier::Read); + m_keyboard_notifier->on_ready_to_read = [this] { drain_keyboard(); }; + } else { + dbgln("Couldn't open /dev/keyboard"); + } - m_mouse_notifier = Core::Notifier::construct(m_mouse_fd, Core::Notifier::Read); - m_mouse_notifier->on_ready_to_read = [this] { drain_mouse(); }; + if (m_mouse_fd >= 0) { + m_mouse_notifier = Core::Notifier::construct(m_mouse_fd, Core::Notifier::Read); + m_mouse_notifier->on_ready_to_read = [this] { drain_mouse(); }; + } else { + dbgln("Couldn't open /dev/mouse"); + } } EventLoop::~EventLoop() |