From 4c23f0e142d01cb4638847ec6702ad23acc89770 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Sun, 26 Nov 2023 00:21:52 -0500 Subject: [PATCH] LibCore: Log a message before failure in `EventLoop::current()` If no EventLoop is present in the stack (like when you forget to create one), a message is nicer than letting the developer go through the stacktrace to figure out what went wrong. --- Userland/Libraries/LibCore/EventLoop.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Userland/Libraries/LibCore/EventLoop.cpp b/Userland/Libraries/LibCore/EventLoop.cpp index 98ffbe518f..3a82ea4d5f 100644 --- a/Userland/Libraries/LibCore/EventLoop.cpp +++ b/Userland/Libraries/LibCore/EventLoop.cpp @@ -54,6 +54,8 @@ bool EventLoop::is_running() EventLoop& EventLoop::current() { + if (event_loop_stack().is_empty()) + dbgln("No EventLoop is present, unable to return current one!"); return event_loop_stack().last(); }