Skip to content

Commit

Permalink
Guard diag in avifDiagnosticsClearError()
Browse files Browse the repository at this point in the history
  • Loading branch information
y-guyon authored Aug 4, 2023
1 parent 3e66456 commit 173961d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

void avifDiagnosticsClearError(avifDiagnostics * diag)
{
*diag->error = '\0';
if (diag) {
*diag->error = '\0';
}
}

#ifdef __clang__
Expand All @@ -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) {
Expand Down

0 comments on commit 173961d

Please sign in to comment.