From f62cbcd89056224c56174a45bd732a0b5eb7742d Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sat, 18 Jan 2025 14:24:44 +0300 Subject: [PATCH] fixup panic on watch Signed-off-by: Vasiliy Tolstov --- registry.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/registry.go b/registry.go index aa2a9fb..0c7a3b8 100644 --- a/registry.go +++ b/registry.go @@ -291,6 +291,9 @@ func (r *rtr) watchRegister(w register.Watcher) error { } break } + if res == nil { + continue + } // don't process nil entries if res.Service == nil { @@ -301,7 +304,7 @@ func (r *rtr) watchRegister(w register.Watcher) error { } if r.opts.Logger.V(logger.TraceLevel) { - r.opts.Logger.Trace(r.opts.Context, fmt.Sprintf("Router dealing with next route %s %+v\n", res.Action, res.Service)) + r.opts.Logger.Trace(r.opts.Context, fmt.Sprintf("Router dealing with next route %s %+v", res.Action, res.Service)) } // get the services domain from metadata. Fallback to wildcard.