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