Skip to content

Commit 8d4813f

Browse files
committed
remove try from dllmain (scary)
1 parent 85fe11f commit 8d4813f

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

loader/src/platform/windows/main.cpp

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -368,26 +368,20 @@ BOOL WINAPI DllMain(HINSTANCE module, DWORD reason, LPVOID) {
368368
// some slight optimizations if a mod frequently creates and deletes threads.
369369
DisableThreadLibraryCalls(module);
370370

371-
try {
372-
// if we find the old bootstrapper dll, don't load geode, copy new updater and let it do the rest
373-
auto workingDir = dirs::getGameDir();
374-
std::error_code error;
375-
bool oldBootstrapperExists = std::filesystem::exists(workingDir / "GeodeBootstrapper.dll", error);
376-
if (error) {
377-
earlyError("There was an error checking whether the old GeodeBootstrapper.dll exists: " + error.message());
378-
return FALSE;
379-
}
380-
else if (oldBootstrapperExists)
381-
CreateThread(nullptr, 0, upgradeThread, nullptr, 0, nullptr);
382-
else if (auto error = loadGeode(); !error.empty()) {
383-
earlyError(error);
384-
return TRUE;
385-
}
386-
}
387-
catch(...) {
388-
earlyError("There was an unknown error somewhere very very early and this is really really bad.");
371+
// if we find the old bootstrapper dll, don't load geode, copy new updater and let it do the rest
372+
auto workingDir = dirs::getGameDir();
373+
std::error_code error;
374+
bool oldBootstrapperExists = std::filesystem::exists(workingDir / "GeodeBootstrapper.dll", error);
375+
if (error) {
376+
earlyError("There was an error checking whether the old GeodeBootstrapper.dll exists: " + error.message());
389377
return FALSE;
390378
}
379+
else if (oldBootstrapperExists)
380+
CreateThread(nullptr, 0, upgradeThread, nullptr, 0, nullptr);
381+
else if (auto error = loadGeode(); !error.empty()) {
382+
earlyError(error);
383+
return TRUE;
384+
}
391385

392386
return TRUE;
393387
}

0 commit comments

Comments
 (0)