Fixes https://github.com/libsdl-org/SDL/pull/5127 (cherry picked from commit a2f4783e753e499c7f6660bf34e337618239a72f)