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,