Skip to content
This repository has been archived by the owner on Jan 4, 2025. It is now read-only.

Commit

Permalink
Merge pull request #920 from ironmansoftware/919
Browse files Browse the repository at this point in the history
Fixes #919
  • Loading branch information
adamdriscoll authored Jun 29, 2019
2 parents 58e2898 + fc22f6a commit c73477b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/UniversalDashboard/Cmdlets/StartDashboardCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ protected override void EndProcessing()

if (Force) {
var existingServer = Server.Servers.FirstOrDefault(m => m.Port == Port || m.Name == m.Name);
existingServer.Stop();
Server.Servers.Remove(existingServer);
if (existingServer != null) {
existingServer.Stop();
Server.Servers.Remove(existingServer);
}
}

// Cache dashboard
Expand Down
6 changes: 4 additions & 2 deletions src/UniversalDashboard/Cmdlets/StartRestApiCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ protected override void EndProcessing()

if (Force) {
var existingServer = Server.Servers.FirstOrDefault(m => m.Port == Port || m.Name == m.Name);
existingServer.Stop();
Server.Servers.Remove(existingServer);
if (existingServer != null) {
existingServer.Stop();
Server.Servers.Remove(existingServer);
}
}

var server = new Server(Name, MyInvocation.ScriptName, AutoReload, Host, Port);
Expand Down

0 comments on commit c73477b

Please sign in to comment.