[kicad-cli] crash when processing schematic that references title block variables
Description
If you reference a title block variable from a sheet instance, kicad is fine but kicad-cli segfaults.
gdb says it all
#3 0x00007ffff1e8ad8b in SCHEMATIC::ResolveTextVar (this=0x555555a94720, aSheetPath=0x7fffffffba20,
token=0x7fffffffbae0, aDepth=<optimized out>) at eeschema/schematic.cpp:271
271 if( aSheetPath->LastScreen()->GetTitleBlock().TextVarResolver( token, m_project ) )
(gdb) print aSheetPath->LastScreen()
$2 = (SCH_SCREEN *) 0x0
Steps to reproduce
- Extract this project: cli_crash.zip
- Run
kicad-cli sch export pdf test.kicad_sch
- boom
KiCad Version
Application: KiCad Schematic Editor x86_64 on x86_64
Version: 8.0.1-138-ga155dd32e8, release build
Libraries:
wxWidgets 3.2.4
FreeType 2.11.1
HarfBuzz 2.7.4
FontConfig 2.13.1
libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.17
Platform: Ubuntu 22.04.4 LTS, 64 bit, Little endian, wxGTK, X11, xubuntu, x11
Build Info:
Date: Apr 11 2024 10:25:36
wxWidgets: 3.2.1 (wchar_t,wx containers) GTK+ 3.24
Boost: 1.74.0
OCC: 7.6.3
Curl: 7.81.0
ngspice: 36
Compiler: GCC 11.4.0 with C++ ABI 1016
Build settings: