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