2
2
mirror of https://github.com/octoleo/restic.git synced 2024-06-01 00:20:48 +00:00

Add more panic() calls for invalid conditions

This commit is contained in:
Alexander Neumann 2015-10-11 20:45:42 +02:00
parent 7db2369081
commit f188cf81dc
2 changed files with 11 additions and 0 deletions

View File

@ -334,6 +334,10 @@ func (arch *Archiver) dirWorker(wg *sync.WaitGroup, p *Progress, done <-chan str
if node.Type == "dir" {
debug.Log("Archiver.dirWorker", "got tree node for %s: %v", node.path, node.blobs)
if node.Subtree.IsNull() {
panic("invalid null subtree ID")
}
}
}
@ -359,6 +363,9 @@ func (arch *Archiver) dirWorker(wg *sync.WaitGroup, p *Progress, done <-chan str
panic(err)
}
debug.Log("Archiver.dirWorker", "save tree for %s: %v", dir.Path(), id.Str())
if id.IsNull() {
panic("invalid null subtree ID return from SaveTreeJSON()")
}
node.Subtree = &id

View File

@ -215,6 +215,10 @@ func (idx *Index) generatePackList(selectFn func(indexEntry) bool) ([]*packJSON,
packs := make(map[backend.ID]*packJSON)
for id, blob := range idx.pack {
if blob.packID == nil {
panic("nil pack id")
}
if selectFn != nil && !selectFn(blob) {
continue
}