From a2e253591c176dbd422d6a141daac92e219e7949 Mon Sep 17 00:00:00 2001 From: yusing Date: Mon, 14 Apr 2025 06:27:19 +0800 Subject: [PATCH] fix: nil dereference on marshalling service health --- internal/watcher/health/json.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/watcher/health/json.go b/internal/watcher/health/json.go index 47a56ab..9059f5c 100644 --- a/internal/watcher/health/json.go +++ b/internal/watcher/health/json.go @@ -22,7 +22,10 @@ type JSONRepresentation struct { } func (jsonRepr *JSONRepresentation) MarshalMap() map[string]any { - url := jsonRepr.URL.String() + var url string + if jsonRepr.URL != nil { + url = jsonRepr.URL.String() + } if url == "http://:0" { url = "" }