Add additional check

This commit is contained in:
Alexander Neumann 2014-12-01 00:06:29 +01:00
parent d2cda159e1
commit 13fc9fe604
1 changed files with 7 additions and 0 deletions

View File

@ -487,6 +487,13 @@ func (arch *Archiver) saveTree(t *Tree) (Blob, error) {
wg.Wait() wg.Wait()
// check for invalid file nodes
for _, node := range *t {
if node.Type == "file" && node.Content == nil {
return Blob{}, fmt.Errorf("node %v has empty content", node.Name)
}
}
blob, err := arch.SaveJSON(backend.Tree, t) blob, err := arch.SaveJSON(backend.Tree, t)
if err != nil { if err != nil {
return Blob{}, err return Blob{}, err