Skip to content

Commit

Permalink
Fix crashes on macOS due to discrepencies with Mono
Browse files Browse the repository at this point in the history
  • Loading branch information
nwoolls committed Dec 29, 2017
1 parent 5f26b06 commit 1e019a9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions MultiMiner.Win/Forms/Configuration/PoolsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 1e019a9

Please sign in to comment.