Skip to content

Commit

Permalink
Fix a potential zero-division error
Browse files Browse the repository at this point in the history
Closes #14
  • Loading branch information
62832 committed Jul 4, 2024
1 parent c602006 commit 3ccdef9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/gripe/_90/appliede/me/service/EMCStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public void getAvailableStacks(KeyCounter out) {

@Override
public long insert(AEKey what, long amount, Actionable mode, IActionSource source) {
if (amount <= 0 || !(what instanceof EMCKey emc)) {
if (amount <= 0
|| !(what instanceof EMCKey emc)
|| service.getProviders().isEmpty()) {
return 0;
}

Expand Down Expand Up @@ -89,7 +91,7 @@ public long insert(AEKey what, long amount, Actionable mode, IActionSource sourc

@Override
public long extract(AEKey what, long amount, Actionable mode, IActionSource source) {
if (amount <= 0) {
if (amount <= 0 || service.getProviders().isEmpty()) {
return 0;
}

Expand Down

0 comments on commit 3ccdef9

Please sign in to comment.