Fix ParseDataBlock of unconfirmed data
The Data slice was not initialized before calling copy(dst, src)
This commit is contained in:
parent
9942e7c892
commit
d206b8c2bd
1 changed files with 1 additions and 0 deletions
1
data.go
1
data.go
|
@ -54,6 +54,7 @@ func ParseDataBlock(data []byte, dataType uint8, confirmed bool) (*DataBlock, er
|
||||||
return nil, fmt.Errorf("dmr: block CRC error (%#04x != %#04x)", crc, db.CRC)
|
return nil, fmt.Errorf("dmr: block CRC error (%#04x != %#04x)", crc, db.CRC)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
db.Data = make([]byte, db.Length)
|
||||||
copy(db.Data, data[:db.Length])
|
copy(db.Data, data[:db.Length])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue