Do not use assert as it can terminate LogonUI in PLAP use

- assert while on login screen is hard to get out of.

Only one of these occurrences is relevant for PLAP, but not using assert
at all looks a safer option.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
pull/591/head
Selva Nair 2 years ago
parent 80697ecae6
commit 71c0a251bf

@ -26,7 +26,6 @@
#endif
#include <windows.h>
#include <assert.h>
#include "main.h"
#include "openvpn-gui-res.h"
@ -433,7 +432,11 @@ BuildFileList()
}
/* else these parent groups use their saved values */
assert (&o.groups[persistent_gp] == PERSISTENT_ROOT_GROUP); /* sanity check */
if (&o.groups[persistent_gp] != PERSISTENT_ROOT_GROUP)
{
MsgToEventLog(EVENTLOG_ERROR_TYPE, L"%hs:%d Logic error", __func__, __LINE__);
return;
}
if (issue_warnings)
{

@ -35,7 +35,6 @@
#include <commctrl.h>
#include <cryptuiapi.h>
#include <shlwapi.h>
#include <assert.h>
extern options_t o;
static const wchar_t *hfontProp;

@ -37,7 +37,6 @@
#include "openvpn-gui-res.h"
#include "localization.h"
#include "misc.h"
#include "assert.h"
/* Popup Menus */
HMENU hMenu;
@ -154,7 +153,11 @@ CreatePopupMenus()
* even if num_configs = 0, we want num_groups > 0.
* This is guaranteed as the root node is always defined.
*/
assert(o.num_groups > 0);
if (o.num_groups <= 0)
{
MsgToEventLog(EVENTLOG_ERROR_TYPE, L"%hs:%d Logic error - no config groups", __func__, __LINE__);
return;
}
AllocateConnectionMenu();
@ -253,7 +256,11 @@ CreatePopupMenus()
/* Persistent connections always displayed under a submenu */
parent = PERSISTENT_ROOT_GROUP;
}
assert(parent);
if (!parent)
{
MsgToEventLog(EVENTLOG_ERROR_TYPE, L"%hs:%d Logic error - parent = NULL", __func__, __LINE__);
continue; /* ignore this config */
}
/* Add config to the current sub menu */
AppendMenu(parent->menu, MF_POPUP, (UINT_PTR) hMenuConn[c->id], c->config_name);

Loading…
Cancel
Save