From 2cd583ee13ec4660d7fbe6e6d8293744d3343071 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Sat, 20 Jan 2024 06:42:00 +0100 Subject: [PATCH] Prevent asan warning on qsort(): 'src/stdlib/SDL_qsort.c:27:5: runtime error: null pointer passed as argument 1, which is declared to never be null` --- src/stdlib/SDL_qsort.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/stdlib/SDL_qsort.c b/src/stdlib/SDL_qsort.c index 6454b2ca4..3683e99d2 100644 --- a/src/stdlib/SDL_qsort.c +++ b/src/stdlib/SDL_qsort.c @@ -24,6 +24,9 @@ #ifdef HAVE_QSORT void SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)) { + if (!base) { + return; + } qsort(base, nmemb, size, compare); }