From 42c917df5be8d75f79a283a8ed59fbaf099bc973 Mon Sep 17 00:00:00 2001 From: Adam Sandberg Ericsson Date: Sat, 18 Jun 2022 10:01:22 +0100 Subject: rts: allow NULL to be used as an invalid StgStablePtr --- rts/TopHandler.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'rts/TopHandler.c') diff --git a/rts/TopHandler.c b/rts/TopHandler.c index d5175015e7..f3ab55c85e 100644 --- a/rts/TopHandler.c +++ b/rts/TopHandler.c @@ -28,6 +28,10 @@ StgTSO *getTopHandlerThread(void) { ACQUIRE_LOCK(&m); StgWeak *weak = (StgWeak*)deRefStablePtr(topHandlerPtr); RELEASE_LOCK(&m); + if (weak == NULL) { + // topHandlerPtr was never initialised + return NULL; + } const StgInfoTable *info = weak->header.info; load_load_barrier(); if (info == &stg_WEAK_info) { -- cgit v1.2.1