From bda19d759fa7ddf8d989d1e1b1726e04799e600e Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Sun, 21 Jul 2019 20:35:00 +0300 Subject: [PATCH] Fix `Parent Page not found for null (ID: 0, parent_id: 0)` --- .../habbohotel/catalog/CatalogManager.java | 23 ++++++++----------- .../catalog/layouts/CatalogRootLayout.java | 11 +++++++++ 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java index 99296bb2..5e1e81c1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java @@ -283,22 +283,19 @@ public class CatalogManager { Emulator.getLogging().logSQLException(e); } - pages.forEachValue(new TObjectProcedure() { - @Override - public boolean execute(CatalogPage object) { - CatalogPage page = pages.get(object.parentId); + pages.forEachValue((object) -> { + CatalogPage page = pages.get(object.parentId); - if (page != null) { - if (page.id != object.id) { - page.addChildPage(object); - } - } else { - if (object.parentId != -2) { - Emulator.getLogging().logStart("Parent Page not found for " + object.getPageName() + " (ID: " + object.id + ", parent_id: " + object.parentId + ")"); - } + if (page != null) { + if (page.id != object.id) { + page.addChildPage(object); + } + } else { + if (object.parentId != -2) { + Emulator.getLogging().logStart("Parent Page not found for " + object.getPageName() + " (ID: " + object.id + ", parent_id: " + object.parentId + ")"); } - return true; } + return true; }); this.catalogPages.putAll(pages); diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/CatalogRootLayout.java b/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/CatalogRootLayout.java index d219baf4..d73e77a6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/CatalogRootLayout.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/CatalogRootLayout.java @@ -9,6 +9,17 @@ import java.sql.SQLException; public class CatalogRootLayout extends CatalogPage { public CatalogRootLayout() { super(); + + this.id = -1; + this.parentId = -2; + this.rank = 0; + this.caption = "root"; + this.pageName = "root"; + this.iconColor = 0; + this.iconImage = 0; + this.orderNum = -10; + this.visible = true; + this.enabled = true; } public CatalogRootLayout(ResultSet set) throws SQLException {