From 1e019a91649a35554e33a41985a5c7c475f5dc5e Mon Sep 17 00:00:00 2001 From: Nate Woolls Date: Thu, 28 Dec 2017 19:26:01 -0500 Subject: [PATCH] Fix crashes on macOS due to discrepencies with Mono --- MultiMiner.Win/Forms/Configuration/PoolsForm.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MultiMiner.Win/Forms/Configuration/PoolsForm.cs b/MultiMiner.Win/Forms/Configuration/PoolsForm.cs index 668501f11..cbae12247 100644 --- a/MultiMiner.Win/Forms/Configuration/PoolsForm.cs +++ b/MultiMiner.Win/Forms/Configuration/PoolsForm.cs @@ -201,6 +201,8 @@ private void coinConfigurationBindingSource_CurrentChanged(object sender, EventA { if (coinConfigurationBindingSource.Current == null) return; + //prevents a crash under Mono on macOS - "System.IndexOutOfRangeException: list position" + poolListBox.SelectedItem = null; Engine.Data.Configuration.Coin currentConfiguration = (Engine.Data.Configuration.Coin)coinConfigurationBindingSource.Current; adjustProfitCombo.SelectedIndex = (int)currentConfiguration.ProfitabilityAdjustmentType; @@ -218,6 +220,9 @@ private void poolDownButton_Click(object sender, EventArgs e) private void MoveSelectedPool(int offset) { + if (miningPoolBindingSource.Current == null) + return; + Object currentObject = miningPoolBindingSource.Current; int currentIndex = miningPoolBindingSource.IndexOf(currentObject); int newIndex = currentIndex + offset; @@ -423,6 +428,10 @@ private void PopulateWorkerNames() private void userNameCombo_SelectedIndexChanged(object sender, EventArgs e) { MiningPool currentPool = (MiningPool)miningPoolBindingSource.Current; + if (currentPool == null) + { + return; + } //if the password is blank if (String.IsNullOrEmpty(currentPool.Password))