Closed OneEyeMaker closed 7 years ago
When exactly does the stackoverflow error occur? Can you send me the crashlog? Because a stackoverflow protection actually already is in place.
@rubensworks
Place 4 proxy blocks in loop and right-click one of them.
BlockCapabilityProxy.onBlockActivate
just calls onBlockActivate
of next proxy block (in loop) and this causes StackOverflowException
.
Crash Report: https://pastebin.com/621eH87g
Thanks, it looks like onBlockActivate
is the only method that is not protected from stackoverflow, I missed that.
Hello. Firstly, thank you for your mods (and for this mod especially). I've simple suggestion. Capability proxy blocks (accidentally or intentionally) can be placed to form loops. And it can lead to infinite cycles and
StackOverflowException
(read: server crashes). I suggest to add protection against such behavior. It can be accomplished in 3 steps: 1) Add similar method to code of TileCapabilityProxy:2) Call this method in
BlockCapabilityProxy.onBlockActivated
,TileCapabilityProxy.hasCapability
,TileCapabilityProxy.getCapability
. If this method return true, returnfalse
,false
,null
(respectively). 3) Deactivate proxy block, if this method returnstrue
.