Fixed materials not being applied when crafting while holding just enough sheets (#95264)

## About The Pull Request
This will fix #95009. split_stack() calls qdel when the amount reaches
zero, and mats_per_unit is unset, so we shouldn't be accessing src for
materials logic here.

## Why It's Good For The Game
This will fix #95009.

## Changelog

🆑
fix: Fixed materials not being applied when crafting with stacks if said
stack is zero'd in the process.
/🆑
This commit is contained in:
Ghom
2026-02-27 18:17:05 -05:00
committed by GitHub
parent 931377ef03
commit 1337b0276b
+2 -2
View File
@@ -461,8 +461,8 @@
builder.investigate_log("crafted [recipe.title]", INVESTIGATE_CRAFTING)
// Apply mat datums
if(LAZYLEN(mats_per_unit) && !(recipe.crafting_flags & CRAFT_NO_MATERIALS))
var/list/result_mats = mats_per_unit.Copy()
if(LAZYLEN(used_stack.mats_per_unit) && !(recipe.crafting_flags & CRAFT_NO_MATERIALS))
var/list/result_mats = used_stack.mats_per_unit.Copy()
for(var/mat in recipe.removed_mats)
var/to_remove = recipe.removed_mats[mat]
var/datum/material/ref_mat = locate(mat) in result_mats