[master] Pass "" instead of '\0' to png_default_error() in png_err().

This mistake was introduced in libpng-1.2.20beta01.
This commit is contained in:
Glenn Randers-Pehrson
2011-06-03 21:14:55 -05:00
parent adde7b5c1e
commit 9dad5e37ae
3 changed files with 14 additions and 5 deletions

View File

@@ -87,12 +87,17 @@ png_error(png_structp png_ptr, png_const_charp error_message)
void PNGAPI
png_err(png_structp png_ptr)
{
/* Prior to 1.4.8 the error_fn received a NULL pointer, expressed
* erroneously as '\0', instead of the empty string "". This was
* apparently an error, introduced in libpng-1.2.20, and png_default_error
* will crash in this case.
*/
if (png_ptr != NULL && png_ptr->error_fn != NULL)
(*(png_ptr->error_fn))(png_ptr, '\0');
(*(png_ptr->error_fn))(png_ptr, "");
/* If the custom handler doesn't exist, or if it returns,
use the default handler, which will not return. */
png_default_error(png_ptr, '\0');
png_default_error(png_ptr, "");
}
#endif /* PNG_ERROR_TEXT_SUPPORTED */