mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
Merge pull request #2380 from evalapply/master
BUG fix: '' in image mode no longer causes a crash
This commit is contained in:
commit
b93025fa5b
|
@ -29,6 +29,7 @@ class TestImage(PillowTestCase):
|
|||
self.assertEqual(im3.getcolors(), [(10000, 0)])
|
||||
|
||||
self.assertRaises(ValueError, lambda: Image.new("X", (100, 100)))
|
||||
self.assertRaises(ValueError, lambda: Image.new("", (100, 100)))
|
||||
# self.assertRaises(
|
||||
# MemoryError, lambda: Image.new("L", (1000000, 1000000)))
|
||||
|
||||
|
|
|
@ -398,6 +398,9 @@ ImagingNew(const char* mode, int xsize, int ysize)
|
|||
int bytes;
|
||||
Imaging im;
|
||||
|
||||
if (strcmp(mode, "") == 0)
|
||||
return (Imaging) ImagingError_ValueError("empty mode");
|
||||
|
||||
if (strlen(mode) == 1) {
|
||||
if (mode[0] == 'F' || mode[0] == 'I')
|
||||
bytes = 4;
|
||||
|
|
Loading…
Reference in New Issue
Block a user