Fix removing the last bucket

This commit is contained in:
kolaente 2020-04-26 00:57:47 +02:00
parent 231dc3913f
commit f0cb3b5e36
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -205,6 +205,12 @@ func (b *Bucket) Delete() (err error) {
} }
} }
// Remove the bucket itself
_, err = x.Where("id = ?", b.ID).Delete(&Bucket{})
if err != nil {
return
}
// Get the default bucket // Get the default bucket
defaultBucket, err := getDefaultBucket(b.ListID) defaultBucket, err := getDefaultBucket(b.ListID)
if err != nil { if err != nil {
@ -216,8 +222,5 @@ func (b *Bucket) Delete() (err error) {
if err != nil { if err != nil {
return return
} }
// Remove the bucket itself
_, err = x.Where("id = ?", b.ID).Delete(&Bucket{})
return return
} }