Skip to content

Commit 620d16d

Browse files
cmagliealessio-perugini
authored andcommitted
Do not allocate arrays if the saved array is empty
1 parent 1629923 commit 620d16d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

internal/arduino/libraries/libraries.go

+3
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ func (library *Library) UnmarshalBinary(in io.Reader, prefix *paths.Path) error
249249
if err := binary.Read(in, binary.NativeEndian, &len); err != nil {
250250
return nil, err
251251
}
252+
if len == 0 {
253+
return nil, nil
254+
}
252255
res := make([]string, len)
253256
for i := range res {
254257
var err error

0 commit comments

Comments
 (0)