Return after error

This commit is contained in:
Andrew Murray 2019-07-13 13:50:13 +10:00
parent 1c57a41ece
commit 2995fb67c1
2 changed files with 8 additions and 0 deletions

View File

@ -90,6 +90,12 @@ class TestFileJpeg2k(PillowTestCase):
)
self.assert_image_equal(im, test_card)
def test_tiled_offset_too_small(self):
with self.assertRaises(ValueError):
self.roundtrip(
test_card, tile_size=(128, 128), tile_offset=(0, 0), offset=(128, 32)
)
def test_irreversible_rt(self):
im = self.roundtrip(test_card, irreversible=True, quality_layers=[20])
self.assert_image_similar(im, test_card, 2.0)

View File

@ -1211,6 +1211,8 @@ PyImaging_Jpeg2KEncoderNew(PyObject *self, PyObject *args)
PyErr_SetString(PyExc_ValueError,
"JPEG 2000 tile offset too small; top left tile must "
"intersect image area");
Py_DECREF(encoder);
return NULL;
}
if (context->tile_offset_x > context->offset_x