From a1fb73ede0474cc0b066491d9c1ff8a8db386552 Mon Sep 17 00:00:00 2001 From: Maschell Date: Wed, 25 Feb 2026 18:58:08 +0100 Subject: [PATCH] Make __wups_getreent a bit more robust --- libraries/libwups/wups_reent.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/libwups/wups_reent.cpp b/libraries/libwups/wups_reent.cpp index eac7013..642c23c 100644 --- a/libraries/libwups/wups_reent.cpp +++ b/libraries/libwups/wups_reent.cpp @@ -55,7 +55,11 @@ __wups_thread_cleanup(OSThread *thread, } struct _reent * -__wups_getreent(void) { +__wups_getreent() { + if (!wut_get_thread_specific || !wut_set_thread_specific || OSGetCurrentThread() == nullptr) { + return _GLOBAL_REENT; + } + struct __wups_thread_context *context; context = (struct __wups_thread_context *) wut_get_thread_specific(__WUPS_CONTEXT_THREAD_SPECIFIC_ID);