From 0f40d68f2febf6efffd8365e00dd2ccc10c55b90 Mon Sep 17 00:00:00 2001
From: Andreas Klebinger <klebinger.andreas@gmx.at>
Date: Fri, 16 Feb 2024 14:04:41 +0100
Subject: [PATCH] RTS: -Ds - make sure incall is non-zero before dereferencing
 it.

Fixes #24445
---
 rts/Capability.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rts/Capability.c b/rts/Capability.c
index 05f4794befef..c8e15c178d56 100644
--- a/rts/Capability.c
+++ b/rts/Capability.c
@@ -495,7 +495,7 @@ giveCapabilityToTask (Capability *cap USED_IF_DEBUG, Task *task)
     ASSERT_LOCK_HELD(&cap->lock);
     ASSERT(task->cap == cap);
     debugTrace(DEBUG_sched, "passing capability %d to %s %#" FMT_HexWord64,
-               cap->no, task->incall->tso ? "bound task" : "worker",
+               cap->no, task->incall && task->incall->tso ? "bound task" : "worker",
                serialisableTaskId(task));
     ACQUIRE_LOCK(&task->lock);
     if (task->wakeup == false) {
-- 
GitLab