Skip to content

Commit 3363d14

Browse files
authored
Merge pull request #904 from brandond/fix_null_output
Fix successfully unmarshalled nil raw result
2 parents 812a8cf + 1c7c696 commit 3363d14

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: pkg/invoke/exec.go

+6
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ func fixupResultVersion(netconf, result []byte) (string, []byte, error) {
5050
return "", nil, fmt.Errorf("failed to unmarshal raw result: %w", err)
5151
}
5252

53+
// plugin output of "null" is successfully unmarshalled, but results in a nil
54+
// map which causes a panic when the confVersion is assigned below.
55+
if rawResult == nil {
56+
rawResult = make(map[string]interface{})
57+
}
58+
5359
// Manually decode Result version; we need to know whether its cniVersion
5460
// is empty, while built-in decoders (correctly) substitute 0.1.0 for an
5561
// empty version per the CNI spec.

0 commit comments

Comments
 (0)