diff --git a/MultiMiner.Engine/MinerFactory.cs b/MultiMiner.Engine/MinerFactory.cs index d36a8136f..914994fea 100644 --- a/MultiMiner.Engine/MinerFactory.cs +++ b/MultiMiner.Engine/MinerFactory.cs @@ -43,11 +43,16 @@ public MinerDescriptor GetMiner(DeviceKind deviceKind, CoinAlgorithm algorithm, string algorithmName = algorithm.Name; + MinerDescriptor result = null; + if (miners.ContainsKey(algorithmName)) - return Miners.Single(m => m.Name.Equals(miners[algorithmName], StringComparison.OrdinalIgnoreCase)); - if (algorithm.DefaultMiner != null) - return Miners.Single(m => m.Name.Equals(algorithm.DefaultMiner, StringComparison.OrdinalIgnoreCase)); - return null; + // SingleOrDefault - the user may have a config file with a backend + // miner registered that no longer exists in their Miners\ folder + result = Miners.SingleOrDefault(m => m.Name.Equals(miners[algorithmName], StringComparison.OrdinalIgnoreCase)); + if ((result == null) && (algorithm.DefaultMiner != null)) + result = Miners.Single(m => m.Name.Equals(algorithm.DefaultMiner, StringComparison.OrdinalIgnoreCase)); + + return result; } public MinerDescriptor GetMiner(DeviceKind deviceKind, string algorithmName, SerializableDictionary miners)