Skip to content

Commit 78c5bcb

Browse files
committed
fix(opinit): avoid null ptr in calling unmarshal
1 parent 1a84192 commit 78c5bcb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/opinit_bots.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ func readAndUnmarshalKeyFile(keyFilePath string) (*weaveio.KeyFile, error) {
214214
return nil, err
215215
}
216216

217-
var keyFile *weaveio.KeyFile
218-
err = json.Unmarshal(fileData, &keyFile)
217+
keyFile := &weaveio.KeyFile{}
218+
err = json.Unmarshal(fileData, keyFile)
219219
return keyFile, err
220220
}
221221

0 commit comments

Comments
 (0)