Skip the warehouse delete when the owner destroys warehouse rubble

city.warehouse is already null after a combat destruction, which threw in
DELETE_WAREHOUSE. If a new warehouse was placed it would have deleted that
one instead, so only a live (rank != -1) warehouse clears city.warehouse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
MagicBotandClaude Opus 5.5 committed 2026-10-18 09:20:21 -04:00
1 parent e64d64bf18
commit 145bb15232
1 file changed
+5 -2
@@ -98,9 +98,12 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler {
return true;
Warehouse.destroyedWarehouses.remove(building.getObjectUUID());
DbManager.WarehouseQueries.DELETE_WAREHOUSE(city.warehouse);
city.warehouse = null;
// Rubble no longer owns city.warehouse, which may be null or a newly placed warehouse
if (city.warehouse != null && building.getRank() != -1) {
DbManager.WarehouseQueries.DELETE_WAREHOUSE(city.warehouse);
city.warehouse = null;
}
}