From 3b4ba525df522ea3a61b7326a4a5178dca768905 Mon Sep 17 00:00:00 2001 From: Shelikhoo Date: Tue, 14 Jan 2025 20:22:17 +0000 Subject: [PATCH] fix crash when observatory is not found --- app/router/strategy_leastping.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/router/strategy_leastping.go b/app/router/strategy_leastping.go index 184335c47..ea9337052 100644 --- a/app/router/strategy_leastping.go +++ b/app/router/strategy_leastping.go @@ -40,6 +40,11 @@ func (l *LeastPingStrategy) PickOutbound(strings []string) string { })) } + if l.observatory == nil { + newError("cannot find observatory").WriteToLog() + return "" + } + observeReport, err := l.observatory.GetObservation(l.ctx) if err != nil { newError("cannot get observe report").Base(err).WriteToLog()