Fixes https://gitlab.com/kicad/code/kicad/-/issues/22360 (cherry picked from commit bdd98e801f)
bdd98e801f