Fixes https://github.com/libsdl-org/SDL/issues/9174 (cherry picked from commit 177a836653)
177a836653