fix: guard RoomBundleLayout against null RoomManager during catalog init

CatalogManager.loadFurnitureValues() (rare-values feature) iterates every catalog page during GameEnvironment.load(); for a RoomBundleLayout this calls getRoomManager().loadRoom(), but RoomManager is constructed after CatalogManager so getRoomManager() returns null -> NullPointerException -> boot aborts. Null-guard the room load so the bundle resolves lazily at runtime instead.
This commit is contained in:
medievalshell
2026-05-29 00:45:02 +02:00
parent 9c831a9da4
commit c255f1e1b4
@@ -42,14 +42,18 @@ public class RoomBundleLayout extends SingleBundle {
} }
if (this.room == null) { if (this.room == null) {
if (this.roomId > 0) { RoomManager roomManager = Emulator.getGameEnvironment().getRoomManager();
this.room = Emulator.getGameEnvironment().getRoomManager().loadRoom(this.roomId); if (this.roomId > 0 && roomManager != null) {
this.room = roomManager.loadRoom(this.roomId);
if (this.room != null) if (this.room != null)
this.room.preventUnloading = true; this.room.preventUnloading = true;
} else { } else if (this.roomId <= 0) {
LOGGER.error("No room id specified for room bundle {}({})", this.getPageName(), this.getId()); LOGGER.error("No room id specified for room bundle {}({})", this.getPageName(), this.getId());
} }
// roomManager can be null when CatalogManager.loadFurnitureValues() runs
// during GameEnvironment.load() before RoomManager is constructed; in that
// case skip eager room loading — the bundle resolves lazily at runtime.
} }
if (this.room == null) { if (this.room == null) {