-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Smart lamp causes segfault when plugged in and turned on with 0 battery #76319
Comments
/Confirmed although I would have preferred if the save had depleted the battery to make it easier to verify... I had some issues trying to actually get rid of the charges (ended up turning on/off repeatedly to shave one charge off each activation). Edit: Blows up at item.cpp operation item::getlight_emit() line item::getlight_emit checks whether "ammo" is absent, but does so including linked "ammo", i.e. from the linked battery. The following code then proceeds to use the item's internal "ammo" exclusively, blowing up when it's absent. There are (at least) two ways to deal with this:
|
In your A solution, it is definitely reasonable to only allow the light when it has a charge. Think of a laptop, for example. The laptop uses charge, and when plugged in, it simply charges the battery. Dimming the light would be nice, but it's a smart lamp. It could be smart lamp lore to turn off at any hint that the battery couldn't support it, so it wouldn't damage itself. |
Second of Patrik suggestion would be the best one |
Describe the bug
The smart lamp causes a segfault when plugged in and turned on with 0 power. If the smart lamp has charges in its internal battery regardless of it being plugged in or not, no segfault.
#76261 fixed #76245. Unfortunately, this problem was concealed by that one. it looks like "item::getlight_emit()" is the culprit this time.
Attach save file
TESTINGTHREE-trimmed.tar.gz
Steps to reproduce
Expected behavior
No segfault
Screenshots
No response
Versions and configuration
Dark Days Ahead [dda],
Disable NPC Needs [no_npc_food],
Portal Storms Ignore NPCs [personal_portal_storms],
Slowdown Fungal Growth [no_fungal_growth]
]
Additional context
crash.log
The text was updated successfully, but these errors were encountered: