From 4ab57eb90b0d5295bb1a0cc9b26c49a264d6194c Mon Sep 17 00:00:00 2001 From: wuxingzhong Date: Wed, 1 Nov 2023 00:44:25 +0800 Subject: [PATCH] serve dnla: fix crash on graceful exit Before this change, closing a uninitialised chan would cause a crash. --- cmd/serve/dlna/dlna.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cmd/serve/dlna/dlna.go b/cmd/serve/dlna/dlna.go index 2c25918e6..1a2a77914 100644 --- a/cmd/serve/dlna/dlna.go +++ b/cmd/serve/dlna/dlna.go @@ -129,11 +129,10 @@ func newServer(f fs.Fs, opt *dlnaflags.Options) (*server, error) { FriendlyName: friendlyName, RootDeviceUUID: makeDeviceUUID(friendlyName), Interfaces: interfaces, - - httpListenAddr: opt.ListenAddr, - - f: f, - vfs: vfs.New(f, &vfsflags.Opt), + waitChan: make(chan struct{}), + httpListenAddr: opt.ListenAddr, + f: f, + vfs: vfs.New(f, &vfsflags.Opt), } s.services = map[string]UPnPService{