Fixes https://github.com/libsdl-org/SDL/issues/9831 (cherry picked from commit 8ab1ffca8a)
8ab1ffca8a