Fix rare runtime if there are no available organs to take (#87671)

## About The Pull Request

This PR fixes a rare runtime error, regarding lost crew members, that
occurs when there are no organs in the `organs_we_can_take` list, which
causes an exception due to an attempt to `pick()` from an empty list.
## Why It's Good For The Game

The less exceptions exists, the better.
## Changelog
🆑
fix: fixed a rare runtime with lost crew having no organs
/🆑

---------

Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
This commit is contained in:
Jerry
2024-11-04 15:55:17 +01:00
committed by GitHub
co-authored by SmArtKar
parent 8801b312e9
commit 2c95d1d28c
@@ -13,6 +13,8 @@
var/organs_to_take = round(min_organs + (max_organs - min_organs) * severity)
var/list/organs_we_can_take = body.organs - body.get_organ_slot(ORGAN_SLOT_BRAIN)
if (!length(organs_we_can_take))
return
for(var/i in 1 to organs_to_take)
var/obj/organ = pick(organs_we_can_take)
if(prob(organ_save_chance) && saved_movables) //if lucky, we can save the organ and have it be delivered with the body