From 173961dac588d5b7cf0d6749d1aada9050b6197a Mon Sep 17 00:00:00 2001 From: Yannis Guyon Date: Fri, 4 Aug 2023 18:23:24 +0200 Subject: [PATCH] Guard diag in avifDiagnosticsClearError() --- src/diag.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/diag.c b/src/diag.c index d97be9b96b..8512063a2e 100644 --- a/src/diag.c +++ b/src/diag.c @@ -9,7 +9,9 @@ void avifDiagnosticsClearError(avifDiagnostics * diag) { - *diag->error = '\0'; + if (diag) { + *diag->error = '\0'; + } } #ifdef __clang__ @@ -18,7 +20,6 @@ __attribute__((__format__(__printf__, 2, 3))) void avifDiagnosticsPrintf(avifDiagnostics * diag, const char * format, ...) { if (!diag) { - // It is possible this is NULL (e.g. calls to avifFileTypeIsCompatible()) return; } if (*diag->error) {