Check volumespec is nil in FindPluginBySpec

This PR fixes issue #49513
This commit is contained in:
Jing Xu
2017-07-25 14:55:32 -07:00
parent bb48546658
commit c18ecb0825
2 changed files with 15 additions and 0 deletions

View File

@@ -387,6 +387,10 @@ func (pm *VolumePluginMgr) FindPluginBySpec(spec *Spec) (VolumePlugin, error) {
pm.mutex.Lock()
defer pm.mutex.Unlock()
if spec == nil {
return nil, fmt.Errorf("Could not find plugin because volume spec is nil")
}
matches := []string{}
for k, v := range pm.plugins {
if v.CanSupport(spec) {