mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 14:14:45 +03:00
AK: Only try and get the Processor::current_id when it was initialized
This caused a null pointer dereference on early boot, since the gs_base was not set yet.
This commit is contained in:
parent
bc7b0a8986
commit
18d2a74e62
Notes:
sideshowbarker
2024-07-18 04:19:48 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/18d2a74e625 Pull-request: https://github.com/SerenityOS/serenity/pull/9942 Reviewed-by: https://github.com/bgianfo ✅
@ -787,11 +787,15 @@ void vdbgln(StringView fmtstr, TypeErasedFormatParams& params)
|
||||
|
||||
#ifdef __serenity__
|
||||
# ifdef KERNEL
|
||||
if (Kernel::Processor::is_initialized() && Kernel::Thread::current()) {
|
||||
auto& thread = *Kernel::Thread::current();
|
||||
builder.appendff("\033[34;1m[#{} {}({}:{})]\033[0m: ", Kernel::Processor::current_id(), thread.process().name(), thread.pid().value(), thread.tid().value());
|
||||
if (Kernel::Processor::is_initialized()) {
|
||||
if (Kernel::Thread::current()) {
|
||||
auto& thread = *Kernel::Thread::current();
|
||||
builder.appendff("\033[34;1m[#{} {}({}:{})]\033[0m: ", Kernel::Processor::current_id(), thread.process().name(), thread.pid().value(), thread.tid().value());
|
||||
} else {
|
||||
builder.appendff("\033[34;1m[#{} Kernel]\033[0m: ", Kernel::Processor::current_id());
|
||||
}
|
||||
} else {
|
||||
builder.appendff("\033[34;1m[#{} Kernel]\033[0m: ", Kernel::Processor::current_id());
|
||||
builder.appendff("\033[34;1m[Kernel]\033[0m: ");
|
||||
}
|
||||
# else
|
||||
static TriState got_process_name = TriState::Unknown;
|
||||
|
Loading…
Reference in New Issue
Block a user