Fix crash with opening grids that are not connected (grid.getController() will be null and the synchronized stmt will fail)
This commit is contained in:
@@ -112,7 +112,7 @@ public class GuiGrid extends GuiBase {
|
||||
public void drawForeground(int mouseX, int mouseY) {
|
||||
scrollbar.update(this, mouseX, mouseY);
|
||||
|
||||
synchronized (grid.getController()) {
|
||||
|
||||
drawString(7, 7, t("gui.refinedstorage:grid"));
|
||||
|
||||
if (grid.getType() == EnumGridType.CRAFTING) {
|
||||
@@ -158,7 +158,7 @@ public class GuiGrid extends GuiBase {
|
||||
text = String.valueOf(qty);
|
||||
}
|
||||
|
||||
if (hoveringSlotId == slot && GuiScreen.isShiftKeyDown()) {
|
||||
if (hoveringSlotId == slot && GuiScreen.isShiftKeyDown() && qty > 1) {
|
||||
text = String.valueOf(qty);
|
||||
}
|
||||
|
||||
@@ -197,7 +197,6 @@ public class GuiGrid extends GuiBase {
|
||||
drawTooltip(mouseX, mouseY, t("misc.refinedstorage:clear"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<StorageItem> getItems() {
|
||||
List<StorageItem> items = new ArrayList<StorageItem>();
|
||||
@@ -206,6 +205,7 @@ public class GuiGrid extends GuiBase {
|
||||
return items;
|
||||
}
|
||||
|
||||
synchronized (grid.getController()) {
|
||||
items.addAll(grid.getController().getItems());
|
||||
|
||||
if (!searchField.getText().trim().isEmpty()) {
|
||||
@@ -254,6 +254,7 @@ public class GuiGrid extends GuiBase {
|
||||
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int mouseX, int mouseY, int clickedButton) throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user