Bug fix for nil pointer on image save

This commit is contained in:
Samuel Hawksby-Robinson 2020-11-12 15:38:35 +00:00 committed by Andrea Maria Piana
parent d6c3153fe8
commit 8be391fc79
2 changed files with 5 additions and 2 deletions

View File

@ -87,7 +87,10 @@ func (d *Database) StoreIdentityImages(iis []*IdentityImage) (err error) {
defer stmt.Close()
for _, ii := range iis {
_, err = stmt.Exec(&ii.Name, &ii.Payload, &ii.Width, &ii.Height, &ii.FileSize, &ii.ResizeTarget)
if ii == nil {
continue
}
_, err = stmt.Exec(ii.Name, ii.Payload, ii.Width, ii.Height, ii.FileSize, ii.ResizeTarget)
if err != nil {
return
}

View File

@ -20,7 +20,7 @@ func GenerateIdentityImages(filepath string, aX, aY, bX, bY int) ([]*IdentityIma
return nil, err
}
iis := make([]*IdentityImage, len(ResizeDimensions))
var iis []*IdentityImage
for _, s := range ResizeDimensions {
rImg := Resize(s, cImg)