fix return_inv() returning a null sometimes, causing get_all_gear() to runtime (#81344)

## About The Pull Request

Fixes the return_inv() proc of datum/storage returning a null in
addition to inventory items. This caused get_all_gear() proc of
mob/living to runtime at times, because it would try to recursively
access a null's inventory...
## Why It's Good For The Game

Bugs bad.
## Changelog
🆑
fix: fix heretic's rust mark failing to damage any items if the victim
has any container on them with another item inside, and maybe other bugs
of similar nature
/🆑
This commit is contained in:
ViktorKoL
2024-02-08 22:37:14 +01:00
committed by GitHub
parent c0162f49ac
commit 1f2bf04e75
+2 -3
View File
@@ -605,12 +605,11 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches)
*/
/datum/storage/proc/return_inv(recursive = TRUE)
var/list/ret = list()
ret |= real_location.contents
for(var/atom/found_thing as anything in real_location)
ret |= found_thing
if(recursive)
ret |= found_thing.atom_storage?.return_inv(ret, recursive = TRUE)
if(recursive && found_thing.atom_storage)
ret |= found_thing.atom_storage.return_inv(recursive = TRUE)
return ret