Using ${FOOTPRINT_NAME} or ${FOOTPRINT_LIBRARY} variables in symbol texts crashes eeschema if no footprint is selected
Description
eeschema crashes when variable ${FOOTPRINT_NAME} or ${FOOTPRINT_LIBRARY} is used but symbol has no footprint assigned. The variables should return an empty string instead.
I've created one symbol which is used in the schematics editor to create reference drawings in the pcb later. The symbol is always the same but the drawing (footprint) can change. To know which footprint I'm using it is nice that I can use the variable ${FOOTPRINT_NAME} in the value text, so I can see immediately the connected footprint in the schematics without opening the properties. However, if I have not decided yet which footprint I want to use, eeschema crashes as soon as I place the symbol without selected footprint.
I did some tests and found out that the crash only happens for the variables ${FOOTPRINT_NAME} and ${FOOTPRINT_LIBRARY} if there is no footprint selected. The variable can be used in any text (value field or custom text). The variable ${FOOTPRINT} is not affected - if there is no footprint it is just replaced with empty string.
Same problem happens if I directly change the text of ANY symbol in eeschema to one of these variables.
Steps to reproduce
- Place any symbol in eeschema - do NOT assign a footprint
- Change the value field to ${FOOTPRINT_NAME}
- Press OK
KiCad Version
Application: KiCad x86_64 on x86_64
Version: 7.0.7, release build
Libraries: wxWidgets 3.2.2 FreeType 2.13.2 HarfBuzz 8.1.1 FontConfig 2.14.2 libcurl/8.3.0 OpenSSL/3.1.2 zlib/1.3 brotli/1.0.9 zstd/1.5.5 libidn2/2.3.4 libpsl/0.21.2 (+libidn2/2.3.4) libssh2/1.11.0 nghttp2/1.56.0
Platform: Linux 6.5.3-arch1-1 x86_64, 64 bit, Little endian, wxGTK, budgie-desktop, x11
Build Info: Date: Sep 1 2023 17:56:33 wxWidgets: 3.2.2 (wchar_t,wx containers) GTK+ 3.24 Boost: 1.81.0 OCC: 7.6.3 Curl: 8.2.1 ngspice: 41 Compiler: GCC 13.2.1 with C++ ABI 1018
Build settings: KICAD_USE_EGL=ON KICAD_SPICE=ON