File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -42,11 +42,13 @@ func (lump *Leaf) Unmarshall(raw []byte) (err error) {
42
42
i := 0
43
43
44
44
for i < numLeafs {
45
- rawLeaf := bytes .NewBuffer (raw [(structSize * i ) : (structSize * i )+ structSize ])
45
+ leafBuf := make ([]byte , structSize )
46
+ copy (leafBuf , raw [(structSize * i ) : (structSize * i )+ structSize ])
46
47
// Pad the raw data to the correct size of a leaf
47
48
if lump .Version () > maxBspVersionOfV0Leaf {
48
- rawLeaf . Write ( make ([]byte , int (unsafe .Sizeof (common.CompressedLightCube {}))))
49
+ leafBuf = append ( leafBuf , make ([]byte , int (unsafe .Sizeof (common.CompressedLightCube {})))... )
49
50
}
51
+ rawLeaf := bytes .NewBuffer (leafBuf )
50
52
err = binary .Read (rawLeaf , binary .LittleEndian , & lump .data [i ])
51
53
if err != nil {
52
54
return err
You can’t perform that action at this time.
0 commit comments