Skip to content

Commit

Permalink
Added error-handling
Browse files Browse the repository at this point in the history
  • Loading branch information
CBennerstedt authored Jan 14, 2021
1 parent 8d32260 commit 0af9fd9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions CMAppCreator/Default.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,11 @@ private bool TestConnection(string _siteServerName)
((System.Security.Principal.WindowsIdentity)User.Identity).Impersonate();
WqlConnectionManager connectionManager = smsProvider.Connect(_siteServerName);
impersonationContext.Undo();
connectionManager.Dispose();
results = true;
if (connectionManager !=null)
{
connectionManager.Dispose();
results = true;
}
}
catch (Exception ex)
{
Expand Down

0 comments on commit 0af9fd9

Please sign in to comment.