Create

Create

86M Downloads

[Create 0.5] ItemDescription's use of getProvider is not null safe

wchen1990 opened this issue ยท 0 comments

commented

If a mod based on Create does not provide a IStressValueProvider the following lines would cause a NullPointerException:

Couple<Integer> generatedRPM = BlockStressValues.getProvider(block)
.getGeneratedRPM(block);

BlockStressValues.getProvider is marked as nullable so there should be a check at the very least before we call getGeneratedRPM. Like so:

Couple<Integer> generatedRPM = BlockStressValues.getProvider(block) != null ?
    BlockStressValues.getProvider(block).getGeneratedRPM(block)
    : null;