Fixes a runtime with cyborg stacks being initialized with no power source (#20848)

* begone runtime

* refactor
This commit is contained in:
Contrabang
2023-04-22 03:43:51 -04:00
committed by GitHub
parent 80dffdc225
commit b47f22ffb9
+6 -3
View File
@@ -298,9 +298,12 @@
return TRUE
/obj/item/stack/proc/get_amount()
if(is_cyborg)
return round(source.energy / cost)
return amount
if(!is_cyborg)
return amount
if(!source) // The energy source has not yet been initializied
return 0
return round(source.energy / cost)
/obj/item/stack/proc/get_max_amount()
return max_amount