Crashing when scrolling through my weapons stash and coming on the combat knife.
Go towards dresser I was using for weapons storage directly north of the character, scroll down to the combat knife, and the game will give this error:
Hitting ignore causes it to happen until you hit retry or abort, where the game will then throw up the crash notification.
This happens if you scroll either down to the combat knife, or scroll up into it, so it is the fault of the combat knife as far as I can tell.
To be able to scroll through the weapons cache without incident.
Add any other context about the problem here.
Save file:
Pacific Grove.zip
Crash info:
Crash info.zip
Just had the same error message.
Confirmed. You can choose to ignore it on the Runtime Assertion menu in the crafting menu, but it doesn't work anywhere else.
It also causes an Assertion failed on all other similar bayonet style items. It crashes on a completely clean, no mods world, and in a backup version 0.D-8805-g50cb40a.
EDIT: After some testing, the crash seems to have started in version 0.D-8800-gdc60bb2 build 9803. I'm not sure what in that build could cause this.
I can reproduce this on current master trying to select a combat knife in the debug item spawn menu.
cataclysm-tiles: src/optional.h:45: const T& cata::optional<T>::get() const [with T = islot_mod]: Assertion `full' failed.
The program has crashed.
See the log file for a stack trace.
CRASH LOG FILE: ./config/crash.log
VERSION: 0.D-8845-g32025a2649
TYPE: Signal
MESSAGE: SIGABRT: Abnormal terminationError creating SDL message box: No message system available
STACK TRACE:
./cataclysm-tiles(_Z21debug_write_backtraceRSo+0x38) [0x563fb19a5b77]
./cataclysm-tiles(+0x731d06) [0x563fb1984d06]
./cataclysm-tiles(+0x7321f2) [0x563fb19851f2]
/usr/lib/libc.so.6(+0x3bfb0) [0x7f59b3333fb0]
/usr/lib/libc.so.6(gsignal+0x145) [0x7f59b3333f25]
/usr/lib/libc.so.6(abort+0x12b) [0x7f59b331d897]
/usr/lib/libc.so.6(+0x25767) [0x7f59b331d767]
/usr/lib/libc.so.6(+0x34526) [0x7f59b332c526]
./cataclysm-tiles(_ZNK4item4infoB5cxx11ERSt6vectorI8iteminfoSaIS1_EEPK14iteminfo_queryi+0xaedf) [0x563fb1d21543]
./cataclysm-tiles(_ZNK4item4infoB5cxx11EbRSt6vectorI8iteminfoSaIS1_EEi+0x30) [0x563fb1d38e60]
./cataclysm-tiles(_ZNK4item4infoB5cxx11EbRSt6vectorI8iteminfoSaIS1_EE+0x28) [0x563fb1d38eb0]
./cataclysm-tiles(_ZNK4item4infoB5cxx11Eb+0x40) [0x563fb1d38f0c]
./cataclysm-tiles(_ZN18wish_item_callback6selectEiP6uilist+0x507) [0x563fb28cfb45]
./cataclysm-tiles(_ZN6uilist4showEv+0xa79) [0x563fb27a3a31]
./cataclysm-tiles(_ZN6uilist11inputfilterB5cxx11Ev+0xf51) [0x563fb27a4d71]
./cataclysm-tiles(_ZN6uilist5queryEbi+0x6cc) [0x563fb27a55f6]
./cataclysm-tiles(_ZN10debug_menu8wishitemEP6playeriii+0x6d0) [0x563fb28c3fdb]
./cataclysm-tiles(_ZN10debug_menu5debugEv+0x9a) [0x563fb19c29d7]
./cataclysm-tiles(_ZN4game13handle_actionEv+0x3508) [0x563fb1c0d552]
./cataclysm-tiles(_ZN4game7do_turnEv+0xacc) [0x563fb1b75f90]
Attempting to repeat stack trace using debug symbols...
debug_write_backtrace(std::ostream&)
.../src/debug.cpp:620
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider::_Alloc_hider(char*, std::allocator<char> const&)
/usr/include/c++/9.2.0/bits/basic_string.h:157
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::allocator<char> const&)
/usr/include/c++/9.2.0/bits/basic_string.h:441
std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str() const
/usr/include/c++/9.2.0/sstream:180
std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::str() const
/usr/include/c++/9.2.0/sstream:678
log_crash
.../src/crash.cpp:264
signal_handler
.../src/crash.cpp:293
__restore_rt
sigaction.c:?
__GI_raise
:?
__GI_abort
:?
_nl_load_domain.cold
loadmsgcat.c:?
__GI___assert_fail
:?
item::info[abi:cxx11](std::vector<iteminfo, std::allocator<iteminfo> >&, iteminfo_query const*, int) const
.../src/item.cpp:1878 (discriminator 3)
item::info[abi:cxx11](bool, std::vector<iteminfo, std::allocator<iteminfo> >&, int) const
.../src/item.cpp:921 (discriminator 4)
item::info[abi:cxx11](bool, std::vector<iteminfo, std::allocator<iteminfo> >&) const
.../src/item.cpp:916
std::vector<iteminfo, std::allocator<iteminfo> >::~vector()
/usr/include/c++/9.2.0/bits/stl_vector.h:677
item::info[abi:cxx11](bool) const
.../src/item.cpp:909
wish_item_callback::select(int, uilist*)
.../src/wish.cpp:479
uilist::show()
.../src/ui.cpp:651
uilist::inputfilter[abi:cxx11]()
.../src/ui.cpp:266
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const
/usr/include/c++/9.2.0/bits/basic_string.h:187
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const
/usr/include/c++/9.2.0/bits/basic_string.h:222
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()
/usr/include/c++/9.2.0/bits/basic_string.h:231
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
/usr/include/c++/9.2.0/bits/basic_string.h:658
uilist::query(bool, int)
.../src/ui.cpp:862
debug_menu::wishitem(player*, int, int, int)
.../src/wish.cpp:521
debug_menu::debug()
.../src/debug_menu.cpp:1040
game::handle_action()
.../src/handle_action.cpp:2284 (discriminator 6)
game::do_turn()
.../src/game.cpp:1445
And I can't reproduce it on latest experimental, on brand new world without any mods though. Successfully debug-spawned combat knife and examined it without any problems.
I'm on 32025a26 with a save game I started in September, and I'm experiencing this crash.
It looks like the combat knife is incorrectly being identified as a gun in the display code, and then crashing when the item->type->gun pointer is dereferenced.
I'm poking at this now.
Essentially the same as #30676 in different code?
I think it's similar symptoms of the same bug: for some reason, bayonets (I've also had it fail with a sword bayonet as well as the combat knife) are satisfying item::is_gun()
, and then when the game tries to derefence the optional gun islot, it doesn't exist and things crash.
item::is_gun() appears to be functioning correctly and is identifying the weapon as a non-gun type. The problem actually seems to be located at located at line 1884 of item.cpp where it doesn't seem to check the item type before doing the work to render the ammo specifics.
Adding a is_gun() to the start of this statement appears to correct the issue but further testing on my part is still happening to assure it doesn't cause any unintended issues.
line 1884 of item.cpp in the current master is
if( mod.reload_modifier != 0 && parts->test( iteminfo_parts::GUNMOD_RELOAD ) ) {
info.emplace_back( "GUNMOD", _( "Reload modifier: " ), _( "<num>%" ),
iteminfo::lower_is_better, mod.reload_modifier );
}
what change did you make to fix this?
Sorry my mistake. It is actually line 1878 that is causing the issue. The code change I made to avert the assert is as follows
```
if(is_gun() && !type->mod->ammo_modifier.empty() && parts->test( iteminfo_parts::GUNMOD_AMMO ) ) {
for( const ammotype &at : type->mod->ammo_modifier ) {
info.push_back( iteminfo( "GUNMOD", string_format( _( "Ammo:
at->name() ) ) );
}
}
@BT-naH Nice job finding that; that fixed it for my system. Would you please go ahead and submit that one line fix and then I can submit my larger refactor of item::info()
after it merges?
Just tested it myself, the fix works.
Most helpful comment
Confirmed. You can choose to ignore it on the Runtime Assertion menu in the crafting menu, but it doesn't work anywhere else.
It also causes an Assertion failed on all other similar bayonet style items. It crashes on a completely clean, no mods world, and in a backup version 0.D-8805-g50cb40a.
EDIT: After some testing, the crash seems to have started in version 0.D-8800-gdc60bb2 build 9803. I'm not sure what in that build could cause this.