Add more panic() calls for invalid conditions
This commit is contained in:
parent
7db2369081
commit
f188cf81dc
2 changed files with 11 additions and 0 deletions
|
@ -334,6 +334,10 @@ func (arch *Archiver) dirWorker(wg *sync.WaitGroup, p *Progress, done <-chan str
|
||||||
|
|
||||||
if node.Type == "dir" {
|
if node.Type == "dir" {
|
||||||
debug.Log("Archiver.dirWorker", "got tree node for %s: %v", node.path, node.blobs)
|
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)
|
panic(err)
|
||||||
}
|
}
|
||||||
debug.Log("Archiver.dirWorker", "save tree for %s: %v", dir.Path(), id.Str())
|
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
|
node.Subtree = &id
|
||||||
|
|
||||||
|
|
|
@ -215,6 +215,10 @@ func (idx *Index) generatePackList(selectFn func(indexEntry) bool) ([]*packJSON,
|
||||||
packs := make(map[backend.ID]*packJSON)
|
packs := make(map[backend.ID]*packJSON)
|
||||||
|
|
||||||
for id, blob := range idx.pack {
|
for id, blob := range idx.pack {
|
||||||
|
if blob.packID == nil {
|
||||||
|
panic("nil pack id")
|
||||||
|
}
|
||||||
|
|
||||||
if selectFn != nil && !selectFn(blob) {
|
if selectFn != nil && !selectFn(blob) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue