From adf4fa64a2e9228365917615c5f97e4b7626accb Mon Sep 17 00:00:00 2001 From: Stefan Koell Date: Wed, 27 Sep 2023 11:58:11 +0200 Subject: [PATCH] Only set username and password property when value is available --- .../Controls/RdpClientExtensions.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/RoyalApps.Community.Rdp.WinForms/Controls/RdpClientExtensions.cs b/src/RoyalApps.Community.Rdp.WinForms/Controls/RdpClientExtensions.cs index 23d7d4c..d9a7619 100644 --- a/src/RoyalApps.Community.Rdp.WinForms/Controls/RdpClientExtensions.cs +++ b/src/RoyalApps.Community.Rdp.WinForms/Controls/RdpClientExtensions.cs @@ -55,8 +55,10 @@ public static void ApplyRdpClientConfiguration(this RdpControl rdpControl, RdpCl } TraceConfigurationData(logger, configuration.Credentials); - rdpClient.UserName = string.IsNullOrEmpty(configuration.Credentials.Username) ? null : configuration.Credentials.Username; - rdpClient.Domain = string.IsNullOrEmpty(configuration.Credentials.Domain) ? null : configuration.Credentials.Domain; + if (!string.IsNullOrEmpty(configuration.Credentials.Username)) + rdpClient.UserName = configuration.Credentials.Username; + if (!string.IsNullOrEmpty(configuration.Credentials.Domain)) + rdpClient.Domain = configuration.Credentials.Domain; var password = configuration.Credentials.Password?.GetValue(); if (!string.IsNullOrEmpty(password)) rdpClient.Password = password;