Add NULL checks in the private debug APIs that testpdfio calls.

This commit is contained in:
Michael R Sweet 2024-08-21 09:22:58 -04:00
parent 6cb661f0f4
commit 7c3651671b
No known key found for this signature in database
GPG Key ID: BE67C75EC81F3244
3 changed files with 9 additions and 0 deletions

View File

@ -363,6 +363,9 @@ _pdfioArrayDebug(pdfio_array_t *a, // I - Array
_pdfio_value_t *v; // Current value _pdfio_value_t *v; // Current value
if (!a)
return;
putc('[', fp); putc('[', fp);
for (i = a->num_values, v = a->values; i > 0; i --, v ++) for (i = a->num_values, v = a->values; i > 0; i --, v ++)
_pdfioValueDebug(v, fp); _pdfioValueDebug(v, fp);

View File

@ -194,6 +194,9 @@ _pdfioDictDebug(pdfio_dict_t *dict, // I - Dictionary
_pdfio_pair_t *pair; // Current pair _pdfio_pair_t *pair; // Current pair
if (!dict)
return;
for (i = dict->num_pairs, pair = dict->pairs; i > 0; i --, pair ++) for (i = dict->num_pairs, pair = dict->pairs; i > 0; i --, pair ++)
{ {
fprintf(fp, "/%s", pair->key); fprintf(fp, "/%s", pair->key);

View File

@ -215,6 +215,9 @@ void
_pdfioValueDebug(_pdfio_value_t *v, // I - Value _pdfioValueDebug(_pdfio_value_t *v, // I - Value
FILE *fp) // I - Output file FILE *fp) // I - Output file
{ {
if (!v)
return;
switch (v->type) switch (v->type)
{ {
case PDFIO_VALTYPE_ARRAY : case PDFIO_VALTYPE_ARRAY :