Fix macos crashing on hook enabling

This commit is contained in:
altalk23 2023-04-10 14:35:09 +03:00
parent 80b5b20efb
commit f89cdcd78a
3 changed files with 4 additions and 4 deletions

View file

@ -795,6 +795,7 @@ void Loader::Impl::provideNextMod(Mod* mod) {
Mod* Loader::Impl::takeNextMod() {
if (!m_nextMod) {
m_nextMod = this->createInternalMod();
log::debug("Created internal mod {}", m_nextMod->getName());
}
auto ret = m_nextMod;
return ret;

View file

@ -520,8 +520,7 @@ bool Mod::Impl::depends(std::string const& id) const {
Result<> Mod::Impl::enableHook(Hook* hook) {
auto res = hook->enable();
if (res) m_hooks.push_back(hook);
else {
if (!res) {
log::error("Can't enable hook {} for mod {}: {}", hook->getDisplayName(), m_info.id(), res.unwrapErr());
}
@ -533,6 +532,7 @@ Result<> Mod::Impl::disableHook(Hook* hook) {
}
Result<Hook*> Mod::Impl::addHook(Hook* hook) {
m_hooks.push_back(hook);
if (LoaderImpl::get()->isReadyToHook()) {
if (hook->getAutoEnable()) {
auto res = this->enableHook(hook);

View file

@ -152,7 +152,6 @@ $execute {
}
int geodeEntry(void* platformData) {
// set up internal mod, settings and data
auto internalSetupRes = LoaderImpl::get()->setupInternalMod();
if (!internalSetupRes) {
@ -178,7 +177,7 @@ int geodeEntry(void* platformData) {
return 1;
}
log::debug("Set up loader");
log::info("Set up loader");
// open console
if (Mod::get()->getSettingValue<bool>("show-platform-console")) {