Fixes https://gitlab.com/kicad/code/kicad/issues/5796 (cherry picked from commit 0036f44e37)
0036f44e37
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8128