Skip to content
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

Segmentation Fault When Asking NPC to Farm #70371

Closed
Voideka opened this issue Dec 23, 2023 · 3 comments · Fixed by #70468
Closed

Segmentation Fault When Asking NPC to Farm #70371

Voideka opened this issue Dec 23, 2023 · 3 comments · Fixed by #70468
Labels
<Crash / Freeze> Fatal bug that results in hangs or crashes. (S2 - Confirmed) Bug that's been confirmed to exist

Comments

@Voideka
Copy link

Voideka commented Dec 23, 2023

Describe the bug

I was trying to get my NPC follower to harvest the corn in a pre-genned farm field. I set up a fairly large farming zone, but was holding no seeds so the zone was set to "No Seed". After making this zone, I saved it and told my NPC to do some farming work. After waiting a couple of turns an error pops up about an invalid recipe, and after telling the game to ignore the error, the client segfaults. The error before the segfault is as follows:

DEBUG : invalid recipe id ""

FUNCTION : obj
FILE : D:\a\Cataclysm-DDA\Cataclysm-DDA\src\recipe_dictionary.cpp
LINE : 68
VERSION : c6f6397

Attach save file

Lilymoor-trimmed.tar.gz

Steps to reproduce

  1. Spawn a player on a Farm Field with harvestable corn.
  2. Spawn an NPC follower for the player.
  3. Use the Zone Manager to designate an area of corn to be harvested, with No Seed selected.
  4. Speak to the NPC, and pick "There's something I want you to do.", then "Let's talk about your current activity.", followed by "Please do some farming work."
  5. Wait several turns.
  6. When the error report pops up, press "i" to ignore it.

Expected behavior

The NPC should proceed to harvest the corn instead of crashing the game.

Screenshots

cdda farming zone
It's hard to make out, but you should be able to see the farming zone encompassing the bottom 5 rows of the corn field.

Versions and configuration

  • OS: Windows
    • OS Version: 10.0.19045.3803 (22H2)
  • Game Version: c6f6397 [64-bit]
  • Graphics Version: Tiles
  • Game Language: System language []
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food],
    Portal Storms Ignore NPCs [personal_portal_storms],
    Slowdown Fungal Growth [no_fungal_growth],
    Blaze Industries [blazeindustries],
    sees-player, run, crouch, bleed icons, retrodays [sees_player_retro],
    Voidmod [VoidMod]
    ]

Additional context

debug - Copy.log
crash - Copy.log

@Voideka Voideka added the (S1 - Need confirmation) Report waiting on confirmation of reproducibility label Dec 23, 2023
@BrettDong BrettDong added the <Crash / Freeze> Fatal bug that results in hangs or crashes. label Dec 23, 2023
@fairyarmadillo
Copy link
Contributor

May be related to some map.cpp changes in #69591

I can take a look at it once the game is able to be compiled again.

@fairyarmadillo
Copy link
Contributor

Turns out it's not!

This is a duplicate of #68730 and possibly #68921

May have been caused by #68664

It may be segfaulting because line 1315 in activity_item_handling.cpp (where zone-based farming takes place) was changed from
} else if( here.has_flag_ter_or_furn( ter_furn_flag::TFLAG_PLANTABLE, src_loc ) &&
to
} else if( here.has_flag_ter_or_furn( seed->seed->required_terrain_flag, src_loc ) &&

The zone activities function is a very long chain of else ifs and the next one below farming is crafting, which may be why we're getting an error related to recipes.

@Novacat
Copy link
Contributor

Novacat commented Dec 26, 2023

I can confirm this, except it seems to be related to using any zone-based farming. The NPC is not required to trigger this crash. However, this crash only happens if you have no seed defined for the zone.

It seems the issue is the above check not being able to properly handle if the seed is null.

@Maleclypse Maleclypse added (S2 - Confirmed) Bug that's been confirmed to exist and removed (S1 - Need confirmation) Report waiting on confirmation of reproducibility labels Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Crash / Freeze> Fatal bug that results in hangs or crashes. (S2 - Confirmed) Bug that's been confirmed to exist
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants