master
Tomas Aparicio 11 years ago
parent 1a1ad46155
commit 9c6e6dcf34

@ -46,7 +46,7 @@ func TestImageRotate(t *testing.T) {
} }
func TestImageConvert(t *testing.T) { func TestImageConvert(t *testing.T) {
buf, err := initImage("test_rotate_out.jpg").Convert(PNG) buf, err := initImage("test.jpg").Convert(PNG)
if err != nil { if err != nil {
t.Errorf("Cannot process the image: %#v", err) t.Errorf("Cannot process the image: %#v", err)
} }

@ -15,6 +15,10 @@ import (
func Resize(buf []byte, o Options) ([]byte, error) { func Resize(buf []byte, o Options) ([]byte, error) {
defer C.vips_thread_shutdown() defer C.vips_thread_shutdown()
if len(buf) == 0 {
return nil, errors.New("Image buffer is empty")
}
image, imageType, err := vipsRead(buf) image, imageType, err := vipsRead(buf)
if err != nil { if err != nil {
return nil, err return nil, err

Loading…
Cancel
Save