Be more verbose if image decoding failed.

This commit is contained in:
Sascha L. Teichmann 2015-08-24 10:58:46 +02:00
parent 08031f1dcd
commit 6ae5936de9

View File

@ -93,14 +93,13 @@ func LoadPNG(path string) image.Image {
var err error
var file *os.File
if file, err = os.Open(path); err != nil {
//log.Printf("WARN: %s\n", err)
return image.White
}
defer file.Close()
reader := bufio.NewReader(file)
var img image.Image
if img, err = png.Decode(reader); err != nil {
log.Printf("WARN: %s\n", err)
log.Printf("WARN: decoding '%s' failed: %s\n", path, err)
return image.White
}
return img