diff --git a/dlls/credui/credui_main.c b/dlls/credui/credui_main.c index 1b9c71b256f..99aa9a12dd9 100644 --- a/dlls/credui/credui_main.c +++ b/dlls/credui/credui_main.c @@ -160,20 +160,27 @@ static void CredDialogFillUsernameCombo(HWND hwndUsername, const struct cred_dia DWORD j; BOOL duplicate = FALSE; + if (!credentials[i]->UserName) + continue; + if (params->dwFlags & CREDUI_FLAGS_GENERIC_CREDENTIALS) { - if ((credentials[i]->Type != CRED_TYPE_GENERIC) || !credentials[i]->UserName) + if (credentials[i]->Type != CRED_TYPE_GENERIC) + { + credentials[i]->UserName = NULL; continue; + } } - else + else if (credentials[i]->Type == CRED_TYPE_GENERIC) { - if (credentials[i]->Type == CRED_TYPE_GENERIC) - continue; + credentials[i]->UserName = NULL; + continue; } /* don't add another item with the same name if we've already added it */ for (j = 0; j < i; j++) - if (!strcmpW(credentials[i]->UserName, credentials[j]->UserName)) + if (credentials[j]->UserName + && !strcmpW(credentials[i]->UserName, credentials[j]->UserName)) { duplicate = TRUE; break;