Got a weird crash profiling the slideshow machine

- Seems to be a race condition, try/catch should be good enough
This commit is contained in:
JozsefA 2021-04-06 16:52:34 -07:00
parent 40bdbc7048
commit 4b49763e0c

View File

@ -31,9 +31,13 @@ public class CrafterCTBehaviour extends ConnectedTextureBehaviour {
return false; return false;
if (input1.data.isEmpty() || input2.data.isEmpty()) if (input1.data.isEmpty() || input2.data.isEmpty())
return false; return false;
try {
if (pos.add(input1.data.get(0)) if (pos.add(input1.data.get(0))
.equals(otherPos.add(input2.data.get(0)))) .equals(otherPos.add(input2.data.get(0))))
return true; return true;
} catch (IndexOutOfBoundsException e) {
// race condition. data somehow becomes empty between the last 2 if statements
}
return false; return false;
} }