From 07851c2434bbc94902528b0142533fb9b3ebccc8 Mon Sep 17 00:00:00 2001 From: Steve Streeting Date: Fri, 3 Feb 2017 09:53:38 +0000 Subject: [PATCH] Clearer code path --- commands/command_unlock.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/commands/command_unlock.go b/commands/command_unlock.go index 242d522d..e4dd8fa5 100644 --- a/commands/command_unlock.go +++ b/commands/command_unlock.go @@ -92,11 +92,13 @@ func unlockAbortIfFileModifiedById(id string, lockClient *locking.Client) { locks, _ = lockClient.SearchLocks(filter, 0, false) } - if len(locks) > 0 { - unlockAbortIfFileModified(locks[0].Path) + if len(locks) == 0 { + // Don't block if we can't determine the path, may be cleaning up old data + return } - // Don't block if we can't determine the path, may be cleaning up old data + unlockAbortIfFileModified(locks[0].Path) + } func init() {