comparison gfxconv.c @ 430:77fae3e4e4d3

Fix a segfault due to not checking for NULL file extension entries in dmGetFormatByExt().
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 03 Nov 2012 11:14:16 +0200
parents e2f8c9cbc17a
children e3ebcbc4ace2
comparison
equal deleted inserted replaced
429:e2f8c9cbc17a 430:77fae3e4e4d3
208 208
209 209
210 BOOL dmGetFormatByExt(const char *fext, int *format, int *subformat) 210 BOOL dmGetFormatByExt(const char *fext, int *format, int *subformat)
211 { 211 {
212 int i; 212 int i;
213 if (fext == NULL)
214 return FALSE;
215
213 for (i = 0; i < nconvFormatList; i++) 216 for (i = 0; i < nconvFormatList; i++)
214 { 217 {
215 DMConvFormat *fmt = &convFormatList[i]; 218 DMConvFormat *fmt = &convFormatList[i];
216 if (strcasecmp(fext, fmt->fext) == 0) 219 if (fmt->fext != NULL &&
220 strcasecmp(fext, fmt->fext) == 0)
217 { 221 {
218 *format = fmt->format; 222 *format = fmt->format;
219 *subformat = fmt->subformat; 223 *subformat = fmt->subformat;
220 return TRUE; 224 return TRUE;
221 } 225 }