Skip to content

Commit 6bfdb63

Browse files
authored
Add check if the FailOverPartner key exists first before retrieving its value from the SqlConnectionString (#1614)
1 parent 13b8c7d commit 6bfdb63

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionPoolGroupProviderInfo.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ private PermissionSet CreateFailoverPermission(SqlConnectionString userConnectio
104104
// the server, we will use that name over what was specified
105105
// in the original connection string.
106106

107-
if (null == userConnectionOptions[SqlConnectionString.KEY.FailoverPartner])
107+
if (userConnectionOptions.ContainsKey(SqlConnectionString.KEY.FailoverPartner) &&
108+
null == userConnectionOptions[SqlConnectionString.KEY.FailoverPartner])
108109
{
109110
keywordToReplace = SqlConnectionString.KEY.Data_Source;
110111
}

0 commit comments

Comments
 (0)