From 82c94e98248efbf696ca7f546a66a0761be10a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 3 Jun 2024 12:54:54 +0800 Subject: [PATCH] Fix crash on *bsd --- route/router.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/route/router.go b/route/router.go index e8950f18..880fe5a6 100644 --- a/route/router.go +++ b/route/router.go @@ -1138,6 +1138,9 @@ func (r *Router) AutoDetectInterfaceFunc() control.Func { if r.platformInterface != nil && r.platformInterface.UsePlatformAutoDetectInterfaceControl() { return r.platformInterface.AutoDetectInterfaceControl() } else { + if r.interfaceMonitor == nil { + return nil + } return control.BindToInterfaceFunc(r.InterfaceFinder(), func(network string, address string) (interfaceName string, interfaceIndex int, err error) { remoteAddr := M.ParseSocksaddr(address).Addr if C.IsLinux {