aboutsummaryrefslogtreecommitdiff
path: root/sklad/db.go
diff options
context:
space:
mode:
Diffstat (limited to 'sklad/db.go')
-rw-r--r--sklad/db.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/sklad/db.go b/sklad/db.go
index 8710fb5..3420c23 100644
--- a/sklad/db.go
+++ b/sklad/db.go
@@ -123,12 +123,11 @@ func loadDatabase() error {
// Construct an index that goes from parent containers to their children.
for _, pv := range db.Containers {
- if pv.Parent == "" {
- continue
- }
- if _, ok := indexContainer[pv.Parent]; !ok {
- return fmt.Errorf("container %s has a nonexistent parent %s",
- pv.Id(), pv.Parent)
+ if pv.Parent != "" {
+ if _, ok := indexContainer[pv.Parent]; !ok {
+ return fmt.Errorf("container %s has a nonexistent parent %s",
+ pv.Id(), pv.Parent)
+ }
}
indexChildren[pv.Parent] = append(indexChildren[pv.Parent], pv)
}