comparison ServerMonitor/Forms/ServerSummaryForm.cs @ 23:3866c19535fd

Fix NullReferenceException when checks are executed on a brand new server.
author Brad Greco <brad@bgreco.net>
date Thu, 30 May 2019 21:40:27 -0400
parents b3128fe10d57
children b0af6b4bed4d
comparison
equal deleted inserted replaced
22:48044d9ac000 23:3866c19535fd
125 125
126 /// <summary>Refreshes a single server control.</summary> 126 /// <summary>Refreshes a single server control.</summary>
127 /// <param name="server">The server to refresh.</param> 127 /// <param name="server">The server to refresh.</param>
128 private void RefreshServer(Server server) 128 private void RefreshServer(Server server)
129 { 129 {
130 ServerPanel.Controls.Cast<ServerSummaryControl>().FirstOrDefault(c => c.Server == server).Refresh(); 130 ServerPanel.Controls.Cast<ServerSummaryControl>().FirstOrDefault(c => c.Server == server)?.Refresh();
131 // The server's status might have changed, so refresh the form icon. 131 // The server's status might have changed, so refresh the form icon.
132 UpdateIcon(); 132 UpdateIcon();
133 } 133 }
134 134
135 /// <summary>Flashes the taskbar button for a server form.</summary> 135 /// <summary>Flashes the taskbar button for a server form.</summary>