aboutsummaryrefslogtreecommitdiffstats
path: root/tree.go
diff options
context:
space:
mode:
authorAlberto Cortés <alcortesm@gmail.com>2016-08-09 20:45:01 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-08-09 20:45:01 +0200
commit92648fe0135b48370dfa98d4f31a99a14165b3b2 (patch)
tree106c6d4dbc694eb218638d60af296edef6efcba0 /tree.go
parent61c530655c44f3581738a497ce4d4175658d59c6 (diff)
downloadgo-git-92648fe0135b48370dfa98d4f31a99a14165b3b2.tar.gz
Decode tree bug: incomplete reads break the decoding process (#64)
* Add test that fails for incomplete reads from an object * Fix imcomplete reads
Diffstat (limited to 'tree.go')
-rw-r--r--tree.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/tree.go b/tree.go
index f56d49e..7135813 100644
--- a/tree.go
+++ b/tree.go
@@ -178,8 +178,7 @@ func (t *Tree) Decode(o core.Object) (err error) {
}
var hash core.Hash
- _, err = r.Read(hash[:])
- if err != nil && err != io.EOF {
+ if _, err = io.ReadFull(r, hash[:]); err != nil {
return err
}