Don't attempt to bsearch() on NULL tif_fieldinfo.

This commit is contained in:
Bob Friesenhahn 2007-06-29 19:20:57 +00:00
parent 9dd037e3c9
commit 50f1a6ab77

View File

@ -1,4 +1,4 @@
/* $Id: tif_dirinfo.c,v 1.84 2007-06-28 12:43:07 joris Exp $ */
/* $Id: tif_dirinfo.c,v 1.85 2007-06-29 19:20:57 bfriesen Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -476,6 +476,12 @@ _TIFFFindFieldInfo(TIFF* tif, uint32 tag, TIFFDataType dt)
if (tif->tif_foundfield && tif->tif_foundfield->field_tag == tag &&
(dt == TIFF_ANY || dt == tif->tif_foundfield->field_type))
return tif->tif_foundfield;
/* If we are invoked with no field information, then just return. */
if ( !tif->tif_fieldinfo ) {
return NULL;
}
/* NB: use sorted search (e.g. binary search) */
key.field_tag = tag;