summaryrefslogtreecommitdiff
path: root/system/db/addon.go
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2017-01-10 10:51:11 -0800
committerSteve Manuel <nilslice@gmail.com>2017-01-10 10:51:11 -0800
commit84628c3e00d2e00bb6388c5880555931f826151f (patch)
treefcb2db9d623bd63da6845d4dc9b9b6bccf55c85d /system/db/addon.go
parent79cce3cf292a85c7acc84c07c85aff2c43e29812 (diff)
adding bucket in advance in case it doesnt exist and addon init is called before db Init
Diffstat (limited to 'system/db/addon.go')
-rw-r--r--system/db/addon.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/system/db/addon.go b/system/db/addon.go
index da83b7f..4558532 100644
--- a/system/db/addon.go
+++ b/system/db/addon.go
@@ -138,7 +138,10 @@ func DeleteAddon(key string) error {
func AddonExists(key string) bool {
var exists bool
err := store.View(func(tx *bolt.Tx) error {
- b := tx.Bucket([]byte("__addons"))
+ b, err := tx.CreateBucketIfNotExists([]byte("__addons"))
+ if err != nil {
+ return err
+ }
if b.Get([]byte(key)) == nil {
return nil
}