fix crash when custom menu is disabled
Some checks failed
Build Binaries / Build Windows (push) Has been cancelled
Build Binaries / Build macOS (push) Has been cancelled
Build Binaries / Build Android (64-bit) (push) Has been cancelled
Build Binaries / Build Android (32-bit) (push) Has been cancelled
Build Binaries / Publish (push) Has been cancelled

This commit is contained in:
Chloe 2024-10-14 05:38:44 -07:00
parent 82e703b6ad
commit b69f810dd4
No known key found for this signature in database
GPG key ID: D2D404DD810FE0E3

View file

@ -90,12 +90,14 @@ struct CustomMenuLayer : Modify<CustomMenuLayer, MenuLayer> {
Notification::create("There were errors - see Geode page!", NotificationIcon::Error)->show();
}
m_fields->m_exclamation = CCSprite::createWithSpriteFrameName("exMark_001.png");
m_fields->m_exclamation->setPosition(m_fields->m_geodeButton->getContentSize() - ccp(10, 10));
m_fields->m_exclamation->setID("errors-found");
m_fields->m_exclamation->setZOrder(99);
m_fields->m_exclamation->setScale(.6f);
m_fields->m_geodeButton->addChild(m_fields->m_exclamation);
if (m_fields->m_geodeButton) {
m_fields->m_exclamation = CCSprite::createWithSpriteFrameName("exMark_001.png");
m_fields->m_exclamation->setPosition(m_fields->m_geodeButton->getContentSize() - ccp(10, 10));
m_fields->m_exclamation->setID("errors-found");
m_fields->m_exclamation->setZOrder(99);
m_fields->m_exclamation->setScale(.6f);
m_fields->m_geodeButton->addChild(m_fields->m_exclamation);
}
}
// show if the user tried to be naughty and load arbitrary DLLs
@ -178,9 +180,9 @@ struct CustomMenuLayer : Modify<CustomMenuLayer, MenuLayer> {
[this](server::ServerRequest<std::vector<std::string>>::Value* result) {
if (result->isOk()) {
auto updatesFound = result->unwrap();
if (updatesFound.size() && !m_fields->m_geodeButton->getChildByID("updates-available")) {
if (updatesFound.size() && m_fields->m_geodeButton && !m_fields->m_geodeButton->getChildByID("updates-available")) {
log::info("Found updates for mods: {}!", updatesFound);
if(auto icon = CCSprite::createWithSpriteFrameName("updates-available.png"_spr)) {
// Remove errors icon if it was added, to prevent overlap
if (m_fields->m_exclamation) {