diff --git a/src/client/Microsoft.Identity.Client.Broker/RuntimeBroker.cs b/src/client/Microsoft.Identity.Client.Broker/RuntimeBroker.cs index 98ac832769..4e8dd111ba 100644 --- a/src/client/Microsoft.Identity.Client.Broker/RuntimeBroker.cs +++ b/src/client/Microsoft.Identity.Client.Broker/RuntimeBroker.cs @@ -327,6 +327,12 @@ public async Task AcquireTokenByUsernamePasswordAsync( public async Task RemoveAccountAsync(ApplicationConfiguration appConfig, IAccount account) { Debug.Assert(s_lazyCore.Value != null, "Should not call this API if msal runtime init failed"); + + if (account == null) + { + _logger.Verbose("[WamBroker] No valid account was passed to RemoveAccountAsync. "); + throw new MsalClientException("wam_remove_account_failed", "No valid account was passed."); + } string correlationId = Guid.NewGuid().ToString();