mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-04 21:50:54 +03:00
error handling
This commit is contained in:
parent
6ce6cc7537
commit
294da4e8f5
|
@ -76,7 +76,7 @@ ImagingGetBand(Imaging imIn, int band)
|
||||||
int
|
int
|
||||||
ImagingSplit(Imaging imIn, Imaging bands[4])
|
ImagingSplit(Imaging imIn, Imaging bands[4])
|
||||||
{
|
{
|
||||||
int i, x, y;
|
int i, j, x, y;
|
||||||
|
|
||||||
/* Check arguments */
|
/* Check arguments */
|
||||||
if (!imIn || imIn->type != IMAGING_TYPE_UINT8) {
|
if (!imIn || imIn->type != IMAGING_TYPE_UINT8) {
|
||||||
|
@ -92,6 +92,12 @@ ImagingSplit(Imaging imIn, Imaging bands[4])
|
||||||
|
|
||||||
for (i = 0; i < imIn->bands; i++) {
|
for (i = 0; i < imIn->bands; i++) {
|
||||||
bands[i] = ImagingNew("L", imIn->xsize, imIn->ysize);
|
bands[i] = ImagingNew("L", imIn->xsize, imIn->ysize);
|
||||||
|
if ( ! bands[i]) {
|
||||||
|
for (j = 0; j < i; ++j) {
|
||||||
|
ImagingDelete(bands[j]);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extract bands from image */
|
/* Extract bands from image */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user