add some nil checks for unexpected lock failures

This commit is contained in:
James Bardin 2017-04-05 09:06:47 -04:00
parent c3bfbe6756
commit eeddc3f8ea
1 changed files with 3 additions and 3 deletions

View File

@ -94,9 +94,9 @@ func LockWithContext(ctx context.Context, s State, info *LockInfo) (string, erro
return "", err
}
if le.Info.ID == "" {
// the lock has no ID, something is wrong so don't keep trying
return "", fmt.Errorf("lock error missing ID: %s", err)
if le == nil || le.Info == nil || le.Info.ID == "" {
// If we dont' have a complete LockError, there's something wrong with the lock
return "", err
}
if postLockHook != nil {