From 50ffba9b7f043f787ac39f9a63a7a94e6e595d07 Mon Sep 17 00:00:00 2001 From: peefy Date: Wed, 18 Sep 2024 17:07:30 +0800 Subject: [PATCH] feat: add nil pointer check Signed-off-by: peefy --- go/native/client.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/go/native/client.go b/go/native/client.go index 17742cb4..854d9b4a 100644 --- a/go/native/client.go +++ b/go/native/client.go @@ -52,7 +52,9 @@ func NewNativeServiceClientWithPluginAgent(pluginAgent uint64) *NativeServiceCli c := new(NativeServiceClient) c.svc = serviceNew(pluginAgent) runtime.SetFinalizer(c, func(x *NativeServiceClient) { - serviceDelete(x.svc) + if x.svc != 0 { + serviceDelete(x.svc) + } closeLibrary(lib) }) return c