Fixes https://gitlab.com/kicad/code/kicad/issues/12555 (cherry picked from commit fdf9fcc24d)
fdf9fcc24d