From 6a69879cdf9241160d370642687cacfc29bcb387 Mon Sep 17 00:00:00 2001 From: incrediblejr Date: Fri, 9 Sep 2022 07:07:24 +0200 Subject: [PATCH] Moved exception handling to catch errors in setting-files If user either is missing setting-files (gup.xml+gupOptions.xml+nativeLang.xml) or the XML is malformed a exception is thrown but not caught, leading to missed popup and a 'garbage' value for exitcode. --- src/winmain.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index c1cb0ec6..cedaa635 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -606,21 +606,21 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) customParam = getParamVal('p', lpszCmdLine); } - // Object (gupParams) is moved here because we need app icon form configuration file - GupParameters gupParams("gup.xml"); - appIconFile = gupParams.getSoftwareIcon(); + try { + // Object (gupParams) is moved here because we need app icon form configuration file + GupParameters gupParams("gup.xml"); + appIconFile = gupParams.getSoftwareIcon(); - if (isHelp) - { - ::MessageBoxA(NULL, MSGID_HELP, "GUP Command Argument Help", MB_OK); - return 0; - } + if (isHelp) + { + ::MessageBoxA(NULL, MSGID_HELP, "GUP Command Argument Help", MB_OK); + return 0; + } - GupExtraOptions extraOptions("gupOptions.xml"); - GupNativeLang nativeLang("nativeLang.xml"); + GupExtraOptions extraOptions("gupOptions.xml"); + GupNativeLang nativeLang("nativeLang.xml"); - hInst = hInstance; - try { + hInst = hInstance; if (launchSettingsDlg) { if (extraOptions.hasProxySettings())