mirror of https://github.com/k3s-io/k3s
Add handling empty index key that may cause panic issue
parent
03fe6b962c
commit
a9d631665e
|
@ -55,6 +55,9 @@ func IndexFuncToKeyFuncAdapter(indexFunc IndexFunc) KeyFunc {
|
|||
if len(indexKeys) > 1 {
|
||||
return "", fmt.Errorf("too many keys: %v", indexKeys)
|
||||
}
|
||||
if len(indexKeys) == 0 {
|
||||
return "", fmt.Errorf("unexpected empty indexKeys")
|
||||
}
|
||||
return indexKeys[0], nil
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue