Chem4Word / Version3

Version 3 of Chem4Word - A Chemistry Add-In for Microsoft Word
https://www.chem4word.co.uk
Other
51 stars 14 forks source link

Sequence contains no elements in CustomRibbon Edit #9

Closed MikeWilliams-UK closed 5 years ago

MikeWilliams-UK commented 5 years ago

Line 724 of CustomRibbon.PerformEdit() in Chem4WordRibbon.cs

int maxAtomicNumber = mol.Atoms.Max(x => ((Element)x.Element).AtomicNumber);

Add test to ensure that at least one atom exists in molecule.

Exception

System.InvalidOperationException: Sequence contains no elements
at System.Linq.Enumerable.Max(IEnumerable`1 source)
at System.Linq.Enumerable.Max[TSource](IEnumerable`1 source, Func`2 selector)
at Chem4Word.CustomRibbon.PerformEdit()
in C:\Dev\vsts\chem4word\Version3\src\Chem4Word.V3\Ribbon\Chem4WordRibbon.cs:line 724