Index: ps/trunk/binaries/data/mods/public/gui/common/emptyinit.xml =================================================================== --- ps/trunk/binaries/data/mods/public/gui/common/emptyinit.xml +++ ps/trunk/binaries/data/mods/public/gui/common/emptyinit.xml @@ -1,9 +0,0 @@ - - - - - Index: ps/trunk/binaries/data/mods/public/gui/page_atlas.xml =================================================================== --- ps/trunk/binaries/data/mods/public/gui/page_atlas.xml +++ ps/trunk/binaries/data/mods/public/gui/page_atlas.xml @@ -1,4 +1,3 @@ - common/emptyinit.xml Index: ps/trunk/source/gui/GUIManager.cpp =================================================================== --- ps/trunk/source/gui/GUIManager.cpp +++ ps/trunk/source/gui/GUIManager.cpp @@ -261,21 +261,16 @@ JS::RootedValue initDataVal(cx); JS::RootedValue hotloadDataVal(cx); JS::RootedValue global(cx, scriptInterface->GetGlobalObject()); + if (page.initData) scriptInterface->ReadStructuredClone(page.initData, &initDataVal); + if (hotloadData) scriptInterface->ReadStructuredClone(hotloadData, &hotloadDataVal); - // Call the init() function - if (!scriptInterface->CallFunctionVoid( - global, - "init", - initDataVal, - hotloadDataVal) - ) - { + if (scriptInterface->HasProperty(global, "init") && + !scriptInterface->CallFunctionVoid(global, "init", initDataVal, hotloadDataVal)) LOGERROR("GUI page '%s': Failed to call init() function", utf8_from_wstring(page.name)); - } m_CurrentGUI = oldGUI; }