mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-09 23:15:49 +03:00
check for null input in findMode() and findRawMode()
This commit is contained in:
parent
5afeb11f9a
commit
05d7b313c6
|
@ -68,6 +68,9 @@ const Mode * const MODES[] = {
|
|||
};
|
||||
|
||||
const Mode * findMode(const char * const name) {
|
||||
if (name == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
const Mode * mode;
|
||||
for (int i = 0; (mode = MODES[i]); i++) {
|
||||
if (strcmp(mode->name, name) == 0) {
|
||||
|
@ -433,6 +436,9 @@ const RawMode * const RAWMODES[] = {
|
|||
};
|
||||
|
||||
const RawMode * findRawMode(const char * const name) {
|
||||
if (name == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
const RawMode * rawmode;
|
||||
for (int i = 0; (rawmode = RAWMODES[i]); i++) {
|
||||
if (strcmp(rawmode->name, name) == 0) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user