From 5640232085a9805139c1a8aabab9961d4f3649a8 Mon Sep 17 00:00:00 2001 From: gabrielmer <101006718+gabrielmer@users.noreply.github.com> Date: Thu, 24 Jul 2025 16:33:49 +0200 Subject: [PATCH] fix: only stop health monitor components if not nil (#3526) --- waku/node/health_monitor/node_health_monitor.nim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/waku/node/health_monitor/node_health_monitor.nim b/waku/node/health_monitor/node_health_monitor.nim index fa31c0529..09f37b5e9 100644 --- a/waku/node/health_monitor/node_health_monitor.nim +++ b/waku/node/health_monitor/node_health_monitor.nim @@ -408,8 +408,11 @@ proc startHealthMonitor*(hm: NodeHealthMonitor): Result[void, string] = return ok() proc stopHealthMonitor*(hm: NodeHealthMonitor) {.async.} = - await hm.onlineMonitor.stopOnlineMonitor() - await hm.keepAliveFut.cancelAndWait() + if not hm.onlineMonitor.isNil(): + await hm.onlineMonitor.stopOnlineMonitor() + + if not hm.keepAliveFut.isNil(): + await hm.keepAliveFut.cancelAndWait() proc new*( T: type NodeHealthMonitor,