Fix Parent Page not found for null (ID: 0, parent_id: 0)

This commit is contained in:
Alejandro 2019-07-21 20:35:00 +03:00
parent b9b77d3515
commit bda19d759f
2 changed files with 21 additions and 13 deletions

View File

@ -283,22 +283,19 @@ public class CatalogManager {
Emulator.getLogging().logSQLException(e); Emulator.getLogging().logSQLException(e);
} }
pages.forEachValue(new TObjectProcedure<CatalogPage>() { pages.forEachValue((object) -> {
@Override CatalogPage page = pages.get(object.parentId);
public boolean execute(CatalogPage object) {
CatalogPage page = pages.get(object.parentId);
if (page != null) { if (page != null) {
if (page.id != object.id) { if (page.id != object.id) {
page.addChildPage(object); page.addChildPage(object);
} }
} else { } else {
if (object.parentId != -2) { if (object.parentId != -2) {
Emulator.getLogging().logStart("Parent Page not found for " + object.getPageName() + " (ID: " + object.id + ", parent_id: " + object.parentId + ")"); 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); this.catalogPages.putAll(pages);

View File

@ -9,6 +9,17 @@ import java.sql.SQLException;
public class CatalogRootLayout extends CatalogPage { public class CatalogRootLayout extends CatalogPage {
public CatalogRootLayout() { public CatalogRootLayout() {
super(); 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 { public CatalogRootLayout(ResultSet set) throws SQLException {