From d103b1ddc4d1eb87acf59d98a8389ed73a271e9a Mon Sep 17 00:00:00 2001 From: Rory Piper Date: Fri, 22 Nov 2024 06:19:49 -0500 Subject: [PATCH] Check clientCertFile and caCertFile using string.IsNullOrEmpty in ConnectTo() --- DriverSparkplugB/DriverSparkplugB.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DriverSparkplugB/DriverSparkplugB.cs b/DriverSparkplugB/DriverSparkplugB.cs index 143bd89..d8493e0 100644 --- a/DriverSparkplugB/DriverSparkplugB.cs +++ b/DriverSparkplugB/DriverSparkplugB.cs @@ -292,7 +292,7 @@ private bool ConnectTo(ConnectivityOptions c, out string errorText) } else { - if (c.caCertFile == "") + if (string.IsNullOrEmpty(c.caCertFile)) { client = new MqttClient(c.hostname, c.portnumber, true, (MqttSslProtocols)c.security, null, null); } @@ -311,7 +311,7 @@ private bool ConnectTo(ConnectivityOptions c, out string errorText) } try { - if (c.clientCertFile == null) + if (!string.IsNullOrEmpty(c.clientCertFile)) { if (c.clientCertFormat == 0) // DER {