Fixes https://github.com/libsdl-org/SDL/issues/8731 (cherry picked from commit bb0e0ae080)
bb0e0ae080