mirror of https://github.com/quasar/Quasar.git
Fixed client crash when no hosts to connect
This commit is contained in:
parent
e9fdb1a431
commit
bbcc2f954e
|
@ -2,7 +2,6 @@
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using xClient.Core.Data;
|
||||
using xClient.Core.Utilities;
|
||||
|
||||
namespace xClient.Core.Helper
|
||||
{
|
||||
|
|
|
@ -16,7 +16,10 @@ namespace xClient.Core.Helper
|
|||
public static void CloseMutex()
|
||||
{
|
||||
if (_appMutex != null)
|
||||
{
|
||||
_appMutex.Close();
|
||||
_appMutex = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ namespace xClient.Core.Utilities
|
|||
{
|
||||
public class HostsManager
|
||||
{
|
||||
public bool IsEmpty { get { return _hosts.Count == 0; } }
|
||||
|
||||
private readonly Queue<Host> _hosts = new Queue<Host>();
|
||||
|
||||
public HostsManager(List<Host> hosts)
|
||||
|
|
|
@ -122,8 +122,11 @@ namespace xClient
|
|||
ClientData.InstallPath = Path.Combine(Settings.DIR, ((!string.IsNullOrEmpty(Settings.SUBFOLDER)) ? Settings.SUBFOLDER + @"\" : "") + Settings.INSTALLNAME);
|
||||
GeoLocationHelper.Initialize();
|
||||
|
||||
if (_hosts.IsEmpty)
|
||||
ClientData.Disconnect = true; // no hosts to connect
|
||||
|
||||
if (!MutexHelper.CreateMutex(Settings.MUTEX))
|
||||
ClientData.Disconnect = true;
|
||||
ClientData.Disconnect = true; // process with same mutex is already running
|
||||
|
||||
if (ClientData.Disconnect)
|
||||
return;
|
||||
|
|
|
@ -213,7 +213,7 @@ namespace xServer.Forms
|
|||
private void btnBuild_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(txtTag.Text) && !string.IsNullOrEmpty(txtMutex.Text) && // General Settings
|
||||
lstHosts.Items.Count > 0 && !string.IsNullOrEmpty(txtPassword.Text) && !string.IsNullOrEmpty(txtDelay.Text) && // Connection
|
||||
_hosts.Count > 0 && !string.IsNullOrEmpty(txtPassword.Text) && !string.IsNullOrEmpty(txtDelay.Text) && // Connection
|
||||
!chkInstall.Checked || (chkInstall.Checked && !string.IsNullOrEmpty(txtInstallname.Text)) && // Installation
|
||||
!chkStartup.Checked || (chkStartup.Checked && !string.IsNullOrEmpty(txtRegistryKeyName.Text))) // Installation
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue