Browse Source

Sanity check for deleted vendors

postwipe-mines
MagicBot 5 months ago
parent
commit
1d673ca2e5
  1. 4
      src/engine/db/handlers/dbWarehouseHandler.java
  2. 6
      src/engine/loot/WorkOrder.java

4
src/engine/db/handlers/dbWarehouseHandler.java

@ -200,6 +200,10 @@ public class dbWarehouseHandler extends dbHandlerBase { @@ -200,6 +200,10 @@ public class dbWarehouseHandler extends dbHandlerBase {
while (rs.next()) {
JSONObject jsonObject = new JSONObject(rs.getString("workorder"));
WorkOrder workOrder = new WorkOrder(jsonObject);
if (workOrder.vendor == null)
continue;
submitList.add(workOrder);
}
} catch (Exception e) {

6
src/engine/loot/WorkOrder.java

@ -84,6 +84,11 @@ public class WorkOrder implements Delayed { @@ -84,6 +84,11 @@ public class WorkOrder implements Delayed {
this.completionTime = jsonWorkOrder.getLong("completionTime");
this.runCompleted.set(jsonWorkOrder.getBoolean("runCompleted"));
// Vendor sanity check. Might have been deleted
if (this.vendor == null)
return;
JSONObject productionCostMap = jsonWorkOrder.getJSONObject("production_cost");
for (String key : productionCostMap.keySet()) {
@ -107,6 +112,7 @@ public class WorkOrder implements Delayed { @@ -107,6 +112,7 @@ public class WorkOrder implements Delayed {
for (Object o : tokenList) {
int prefix = ((JSONArray) o).getInt(0);
int suffix = ((JSONArray) o).getInt(1);
Item cookingItem = ForgeManager.forgeItem(this);
cookingItem.prefixToken = prefix;
cookingItem.suffixToken = suffix;

Loading…
Cancel
Save