Fixes https://gitlab.com/kicad/code/kicad/-/issues/10729 (cherry picked from commit 8d003804e0)
8d003804e0