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