mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 07:20:13 +00:00
Added conversion and check to prevent panic
This commit is contained in:
parent
5fa07f57b6
commit
519cbc498b
@ -189,5 +189,8 @@ func (pm *VolumePluginMgr) FindPersistentPluginByName(name string) (PersistentVo
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return volumePlugin.(PersistentVolumePlugin), nil
|
||||
if persistentVolumePlugin, ok := volumePlugin.(PersistentVolumePlugin); ok {
|
||||
return persistentVolumePlugin, nil
|
||||
}
|
||||
return nil, fmt.Errorf("no persistent volume plugin matched")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user