Fix a panic caused by a nil response on kv pre-flight (#6675)

* Fix a panic caused by a nil response on kv pre-flight

* Fix imports
This commit is contained in:
Brian Kassouf 2019-05-03 09:10:41 -07:00 committed by GitHub
parent 252aa1c528
commit 0c9b011709
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
package command
import (
"errors"
"fmt"
"io"
"path"
@ -69,6 +70,9 @@ func kvPreflightVersionRequest(client *api.Client, path string) (string, int, er
if err != nil {
return "", 0, err
}
if secret == nil {
return "", 0, errors.New("nil response from pre-flight request")
}
var mountPath string
if mountPathRaw, ok := secret.Data["path"]; ok {
mountPath = mountPathRaw.(string)