Skip to content

Commit c5a5356

Browse files
Merged PR 421: V3.1.16
* ACME: Protect against nulls in GetBondAdornerGeometry() * Prevent import of empty structure in ChEBI search * ACME: Fix internal exception when copying structure to clipboard * ACME: Fix internal exception when Atom has no parent Related work items: #776, #782, #800
1 parent b5c4820 commit c5a5356

File tree

42 files changed

+501
-366
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+501
-366
lines changed

src/Chem4Word.V3/Data/Chem4Word-Versions.xml

Lines changed: 187 additions & 178 deletions
Large diffs are not rendered by default.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Version>
3-
<Number>3.1.15 Release 5</Number>
4-
<IsBeta>false</IsBeta>
5-
<Released>17-Oct-2020</Released>
3+
<Number>3.1.16 Release 6</Number>
4+
<IsBeta>false</IsBeta>
5+
<Released>17-Dec-2020</Released>
66
</Version>

src/Chem4Word.V3/Data/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@ <h1>Chemistry for Word Add-In 2020</h1>
1515
<td>Setup Bootstrapper</td>
1616
<td><a href="/files3-1/Chem4Word-Setup.exe">Chem4Word-Setup</a></td>
1717
</tr>
18+
<tr>
19+
<td>Version 3.1.16 - Release 6</td>
20+
<td><a href="/files3-1/Chem4Word-Setup.3.1.16.Release.6.msi">Chem4Word-Setup 3.1.16 Release 6</a></td>
21+
</tr>
1822
<tr>
1923
<td>Version 3.1.15 - Release 5</td>
20-
<td><a href="/files3-1/Chem4Word-Setup.3.1.15.Release.5.msi">Chem4Word-Setup 3.1.15 Release 5</a></td>
24+
<td>Chem4Word-Setup 3.1.15 Release 5</td>
2125
</tr>
2226
<tr>
2327
<td>Version 3.1.14 - Release 4</td>

src/Chem4Word.V3/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@
3535
// Build Number
3636
// Revision
3737
//
38-
[assembly: AssemblyVersion("3.1.15.7595")]
39-
[assembly: AssemblyFileVersion("3.1.15.7595")]
38+
[assembly: AssemblyVersion("3.1.16.7656")]
39+
[assembly: AssemblyFileVersion("3.1.16.7656")]

src/Chem4Word.V3/Ribbon/Chem4WordRibbon.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1291,7 +1291,7 @@ private void OnSearcherClick(object sender, RibbonControlEventArgs ribbonControl
12911291
if (searcher != null)
12921292
{
12931293
DialogResult dr = searcher.Search();
1294-
if (dr == DialogResult.OK)
1294+
if (dr == DialogResult.OK && !string.IsNullOrEmpty(searcher.Cml))
12951295
{
12961296
Word.Document doc = Globals.Chem4WordV3.Application.ActiveDocument;
12971297

src/Chem4WordTests/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@
3535
// Build Number
3636
// Revision
3737
//
38-
[assembly: AssemblyVersion("3.1.15.7595")]
39-
[assembly: AssemblyFileVersion("3.1.15.7595")]
38+
[assembly: AssemblyVersion("3.1.16.7656")]
39+
[assembly: AssemblyFileVersion("3.1.16.7656")]

src/Chemistry/Chem4Word.ACME/Adorners/Selectors/MultiAtomBondAdorner.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ public MultiAtomBondAdorner(EditorCanvas currentEditor, List<ChemistryBase> chem
3333

3434
case Bond b:
3535
Debug.Assert(b.Parent != null);
36-
if (b != null)
37-
{
38-
OverallGeometry = new CombinedGeometry(GeometryCombineMode.Union, OverallGeometry, GetBondAdornerGeometry(b));
39-
}
36+
OverallGeometry = new CombinedGeometry(GeometryCombineMode.Union, OverallGeometry, GetBondAdornerGeometry(b));
4037
break;
4138
}
4239
}
@@ -55,19 +52,23 @@ private Geometry GetBondAdornerGeometry(Bond bond)
5552
AtomVisual startAtomVisual = CurrentEditor.GetAtomVisual(bond.StartAtom);
5653
AtomVisual endAtomVisual = CurrentEditor.GetAtomVisual(bond.EndAtom);
5754

55+
Point? sp;
5856
//work out where the bond vector intersects the start and end points of the bond
59-
if (!string.IsNullOrEmpty(bond.StartAtom.SymbolText))
57+
if (!string.IsNullOrEmpty(bond.StartAtom.SymbolText)
58+
&& (sp = startAtomVisual.GetIntersection(bond.StartAtom.Position, bond.EndAtom.Position)) != null)
6059
{
61-
startPoint = startAtomVisual.GetIntersection(bond.StartAtom.Position, bond.EndAtom.Position).Value;
60+
startPoint = sp.Value;
6261
}
6362
else
6463
{
6564
startPoint = bond.StartAtom.Position + unitVector * RenderRadius;
6665
}
6766

68-
if (!string.IsNullOrEmpty(bond.EndAtom.SymbolText))
67+
Point? ep;
68+
if (!string.IsNullOrEmpty(bond.EndAtom.SymbolText)
69+
&& (ep = endAtomVisual.GetIntersection(bond.StartAtom.Position, bond.EndAtom.Position)) != null)
6970
{
70-
endPoint = endAtomVisual.GetIntersection(bond.StartAtom.Position, bond.EndAtom.Position).Value;
71+
endPoint = ep.Value;
7172
}
7273
else
7374
{

src/Chemistry/Chem4Word.ACME/EditViewModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ void RefreshAtoms(Atom startAtom, Atom endAtom)
11631163
}
11641164
else
11651165
{
1166-
WriteTelemetry(module, "Exception", $"Molecule: {mol.Path} StartAtom: {a.Path} EndAtom: {b.Path}");
1166+
WriteTelemetry(module, "Warning", $"Molecule: {mol.Path}{Environment.NewLine}StartAtom: {a.Path} EndAtom: {b.Path}");
11671167
}
11681168
}
11691169
catch (Exception exception)
@@ -1445,6 +1445,7 @@ public void CopySelection()
14451445

14461446
tempModel.RescaleForCml();
14471447
string export = converter.Export(tempModel);
1448+
Clipboard.Clear();
14481449
IDataObject ido = new DataObject();
14491450
ido.SetData(FormatCML, export);
14501451
string header = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";

src/Chemistry/Chem4Word.ACME/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@
3737
//
3838
// You can specify all the values or you can default the Build and Revision Numbers
3939
// by using the '*' as shown below:
40-
// [assembly: AssemblyVersion("3.1.15.7595")]
41-
[assembly: AssemblyVersion("3.1.15.7595")]
42-
[assembly: AssemblyFileVersion("3.1.15.7595")]
40+
// [assembly: AssemblyVersion("3.1.16.7656")]
41+
[assembly: AssemblyVersion("3.1.16.7656")]
42+
[assembly: AssemblyFileVersion("3.1.16.7656")]

src/Chemistry/Chem4Word.Model2/Atom.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ public Atom()
564564
/// </summary>
565565
public string InternalId { get; }
566566

567-
public bool Singleton => Parent.Atoms.Count == 1 && Parent.Atoms.Values.First() == this;
567+
public bool Singleton => Parent?.Atoms.Count == 1 && Parent?.Atoms.Values.First() == this;
568568

569569
#endregion Constructors
570570

0 commit comments

Comments
 (0)