diff --git a/src/Utils/NewProfilePage.cpp b/src/Utils/NewProfilePage.cpp index f4a45a1..ec7cc69 100644 --- a/src/Utils/NewProfilePage.cpp +++ b/src/Utils/NewProfilePage.cpp @@ -142,14 +142,16 @@ You found a GDUtils developer! :O class $modify(ProfilePage) { void loadPageFromUserInfo(GJUserScore* a2) { auto layer = m_mainLayer; - CCMenu* username_menu = typeinfo_cast(layer->getChildByIDRecursive("username-menu")); - CCLabelBMFont* label = typeinfo_cast(layer->getChildByIDRecursive("username-label")); CCMenuItemSpriteExtra* badgeBtn = nullptr; + CCMenuItemSpriteExtra* badgeGDUtilBtn = nullptr; bool modbadge_bool = false; ProfilePage::loadPageFromUserInfo(a2); + CCMenu* username_menu = typeinfo_cast(layer->getChildByIDRecursive("username-menu")); + CCLabelBMFont* label = typeinfo_cast(layer->getChildByIDRecursive("username-label")); + // Keep 7976112 for contributors soon if (layer) { @@ -173,10 +175,10 @@ class $modify(ProfilePage) { std::vector gdutils_accountID_devs = { 7026949, 6253758, 5509312 }; if (std::find(gdutils_accountID_devs.begin(), gdutils_accountID_devs.end(), a2->m_accountID) != gdutils_accountID_devs.end()) { - if (label != nullptr && username_menu != nullptr && !this->getChildByIDRecursive("gdutils-badge"_spr)) { + if (label != nullptr) { auto badgeGDUtil = CCSprite::create(Mod::get()->expandSpriteName("gdutils_badge.png")); badgeGDUtil->setScale(.3f); - auto badgeGDUtilBtn = CCMenuItemSpriteExtra::create( + badgeGDUtilBtn = CCMenuItemSpriteExtra::create( badgeGDUtil, this, menu_selector(NewProfilePage::onGDUtilsBadgePressed) @@ -191,10 +193,8 @@ class $modify(ProfilePage) { username_menu->addChild(badgeGDUtilBtn); } } - } - username_menu->updateLayout(); - - NodeIDs::provideFor(this); + if (username_menu != nullptr) username_menu->updateLayout(); + } } };