From 0eba6754ae6fe81d50eff244900515b564601341 Mon Sep 17 00:00:00 2001 From: hantmac Date: Mon, 2 Dec 2019 10:11:57 +0800 Subject: [PATCH] fix panic because of interface{} is nil --- backend/services/task.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/services/task.go b/backend/services/task.go index 14a609ad..e862c36e 100644 --- a/backend/services/task.go +++ b/backend/services/task.go @@ -302,9 +302,11 @@ func SaveTaskResultCount(id string) func() { // 执行任务 func ExecuteTask(id int) { - if flag, _ := LockList.Load(id); flag.(bool) { - log.Debugf(GetWorkerPrefix(id) + "正在执行任务...") - return + if flag, ok := LockList.Load(id); ok { + if flag.(bool) { + log.Debugf(GetWorkerPrefix(id) + "正在执行任务...") + } + } // 上锁