tasking: Check for null pointer first

This commit is contained in:
EnderIce2
2024-11-19 04:33:47 +02:00
parent 3709683af8
commit 4d192732cc
3 changed files with 20 additions and 1 deletions

View File

@ -157,6 +157,9 @@ namespace Tasking::Scheduler
TCB *Custom::GetThreadByID(TID ID, PCB *Parent)
{
if (unlikely(Parent == nullptr))
return nullptr;
foreach (auto t in Parent->Threads)
{
if (t->ID == ID)
@ -544,6 +547,7 @@ namespace Tasking::Scheduler
{
if (pcb->State.load() == TaskState::Terminated)
{
debug("Found terminated process %s(%d)", pcb->Name, pcb->ID);
delete pcb;
continue;
}