diff --git a/image_test.go b/image_test.go index 3cb74fa..1f38610 100644 --- a/image_test.go +++ b/image_test.go @@ -46,7 +46,7 @@ func TestImageRotate(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 { t.Errorf("Cannot process the image: %#v", err) } diff --git a/resize.go b/resize.go index 2bd9653..e1cfd7a 100644 --- a/resize.go +++ b/resize.go @@ -15,6 +15,10 @@ import ( func Resize(buf []byte, o Options) ([]byte, error) { defer C.vips_thread_shutdown() + if len(buf) == 0 { + return nil, errors.New("Image buffer is empty") + } + image, imageType, err := vipsRead(buf) if err != nil { return nil, err