Always check/return errors.

master
klauspost 2015-06-23 12:16:26 +02:00
parent 888c57c889
commit 5c2ef3ae72
1 changed files with 12 additions and 2 deletions

View File

@ -114,9 +114,19 @@ func New(dataShards, parityShards int) (Encoder, error) {
// This will make the top square be the identity matrix, but
// preserve the property that any square subset of rows is
// invertible.
top, _ := vm.SubMatrix(0, 0, dataShards, dataShards)
top, _ = top.Invert()
top, err := vm.SubMatrix(0, 0, dataShards, dataShards)
if err != nil {
return nil, err
}
top, err = top.Invert()
if err != nil {
return nil, err
}
r.m, err = vm.Multiply(top)
if err != nil {
return nil, err
}
r.parity = make([][]byte, parityShards)
for i := range r.parity {