Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Arithmetic Error #3541

Merged
merged 3 commits into from
Apr 23, 2022
Merged

Fix Arithmetic Error #3541

merged 3 commits into from
Apr 23, 2022

Conversation

lukemango
Copy link
Contributor

Description

We found this issue by accident, but it seems that if Slimefun's ticks are faster than expected, Tier 3 items such as Electric Ore Grinders will produce an ArithmeticException.

https://pastebin.com/ZGWDJyWn - the error from our fork, this small patch fixed it.

Proposed changes

Don't update the progress bar if the operation is already finished

Related Issues (if applicable)

Resolves #3538

Checklist

  • I have fully tested the proposed changes and promise that they will not break everything into chaos.
  • I have also tested the proposed changes in combination with various popular addons and can confirm my changes do not break them.
  • I followed the existing code standards and didn't mess up the formatting.
  • I did my best to add documentation to any public classes or methods I added.
  • I have added Nonnull and Nullable annotations to my methods to indicate their behaviour for null values
  • I added sufficient Unit Tests to cover my code.

@lukemango lukemango requested a review from a team as a code owner April 20, 2022 21:45
Sfiguz7
Sfiguz7 previously approved these changes Apr 20, 2022
Copy link
Member

@Sfiguz7 Sfiguz7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's likely Biscuit will want the update progress to be in an else block but I personally don't mind it. I will just approve and let him or Walshy decide if they want to suggest the change before merging

@Sfiguz7 Sfiguz7 self-assigned this Apr 20, 2022
@lukemango
Copy link
Contributor Author

yeah I mean I don't mind changing it if that's what's preferred :)

@TheBusyBiscuit TheBusyBiscuit added the ✨ Fix This Pull Request fixes an issue. label Apr 20, 2022
@TheBusyBiscuit TheBusyBiscuit self-assigned this Apr 20, 2022
svr333
svr333 previously approved these changes Apr 21, 2022
Copy link
Member

@TheBusyBiscuit TheBusyBiscuit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve of this, I even checked the logic and made a truth table.
But as pointed out, style-wise an inclusive-if would be preferred and we generally like to keep a reference to the fixed issue so we can better track these things.

Otherwise, it looks good! Thanks!

…/MachineProcessor.java

Co-authored-by: TheBusyBiscuit <TheBusyBiscuit@users.noreply.github.com>
@lukemango lukemango dismissed stale reviews from svr333 and Sfiguz7 via 7f70570 April 22, 2022 11:11
Copy link
Member

@Sfiguz7 Sfiguz7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@TheBusyBiscuit TheBusyBiscuit merged commit 2d5c62f into Slimefun:master Apr 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Fix This Pull Request fixes an issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disappering Gold Pans
4 participants