CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.64k stars 4.18k forks source link

Segmentation Fault when consuming antiseptic from vehicle tank #76398

Open BaumgeistOne opened 2 months ago

BaumgeistOne commented 2 months ago

Describe the bug

Why should antiseptic take up precious cargo space, when it could be stored in a vehicle tank? So I did exactly that. But since it does not show up in the "use meds" action anymore, I tried to siphon it, and when prompted what to do with the liquid, I selected "consume". Which then crashed the game.

Attach save file

The Collector-trimmed.tar.gz

Steps to reproduce

  1. Load the save or use own world and fill antiseptic into a vehicle tank.
  2. Examine vehicle, siphon antiseptic.
  3. Choose "consume".
  4. Choose the limb.
  5. Enjoy yet another way to trigger a segfault. :)

Expected behavior

"Consuming" the antiseptic after siphoning it should work.

Screenshots

No response

Versions and configuration

Additional context

CddaCrashDebug.zip

CoroNaut commented 2 months ago

Tested on a more vanilla CDDA, got segfault as well. Placed antiseptic into tank, damaged self, tried to 's'iphon antiseptic, consumed it, segfault. crash.zip TESTINGFIVE-trimmed.tar.gz

PatrikLundell commented 2 months ago

Failed to repeat from "CoroNaut's save. Instead I get an error report (and no PR is currently marked as linked to this issue): DEBUG : Item location/name to be consumed should not be null.

FUNCTION : finish FILE : C:\Cataclysm-DDA\src\activity_actor.cpp LINE : 3245 VERSION : 0.G-12039-g2473620ec6 and nothing is removed from the tank, nor is the wound I debugged in the PC disinfected.

mqrause commented 1 month ago

It's the same commit as in #76425 that's responsible for this (717630e2cfc00dd58d1ef3dd3de40e4f63cf2618). But in this case the actual issue is that vehicle item_locations are only valid for CARGO vehicle parts. Liquid tanks work differently and can't use them.

mqrause commented 1 month ago

So actually the above isn't exactly false, but even without that issue there is a crash, because the first aid activity always assumes the healing item you use is on the character, so it can't handle antiseptic coming from a vehicle tank currently.