Skip to content

Commit 42746e4

Browse files
author
Abhishek Agarwal
authored
fix(controller): change jsonpath value addition condition to avoid index out of range error (#658)
Signed-off-by: Abhishek Agarwal <abhishek.agarwal@mayadata.io>
1 parent 498c632 commit 42746e4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmd/ndm_daemonset/controller/blockdevice.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func addBdLabels(bd *apis.BlockDevice, ctrl *Controller) error {
127127
valueStrings := []string{}
128128
var jsonPathFieldValue string
129129

130-
if len(values) > 0 || len(values[0]) > 0 {
130+
if len(values) > 0 && len(values[0]) > 0 {
131131
for arrIx := range values {
132132
for valIx := range values[arrIx] {
133133
valueStrings = append(valueStrings, fmt.Sprintf("%v", values[arrIx][valIx].Interface()))

0 commit comments

Comments
 (0)