Skip to content

Commit

Permalink
fix: regression cased by migration to struct inside OpenXML v3 (#75)
Browse files Browse the repository at this point in the history
* Chart not supported by Deck Builder

* fix: more struct null comparisons

---------

Co-authored-by: krystyna_hurieieva <[email protected]>
Co-authored-by: Sergey Tihon <[email protected]>
  • Loading branch information
3 people authored Apr 18, 2024
1 parent d2e6aad commit edaf9de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Clippit/PowerPoint/FluentPresentationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,8 @@ private void CopyRelatedPartsForContentParts(OpenXmlPart oldContentPart, OpenXml
if (newContentPart.HasRelationship(relId))
continue;

if (oldContentPart.Parts.FirstOrDefault(p => p.RelationshipId == relId) is {} oldPartIdPair)
var oldPartIdPair = oldContentPart.Parts.FirstOrDefault(p => p.RelationshipId == relId);
if (oldPartIdPair != default)
{
var oldPart = oldPartIdPair.OpenXmlPart;
OpenXmlPart newPart = null;
Expand Down Expand Up @@ -751,7 +752,7 @@ private void CopyRelatedPartsForContentParts(OpenXmlPart oldContentPart, OpenXml
continue;

var oldPartIdPair9 = oldContentPart.Parts.FirstOrDefault(p => p.RelationshipId == relId);
if (oldPartIdPair9 is {})
if (oldPartIdPair9 != default)
{
var newPart = _newDocument.PresentationPart.AddCustomXmlPart(CustomXmlPartType.CustomXml);
using (var stream = oldPartIdPair9.OpenXmlPart.GetStream())
Expand Down
6 changes: 4 additions & 2 deletions Clippit/PowerPoint/PresentationBuilderTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ internal static void CopyChartObjects(ChartPart oldChart, ChartPart newChart)
{
var relId = dataReference.Attribute(R.id).Value;

if (oldChart.Parts.FirstOrDefault(p => p.RelationshipId == relId) is {} oldPartIdPair)
var oldPartIdPair = oldChart.Parts.FirstOrDefault(p => p.RelationshipId == relId);
if (oldPartIdPair != default)
{
switch (oldPartIdPair.OpenXmlPart)
{
Expand Down Expand Up @@ -196,7 +197,8 @@ internal static void CopyExtendedChartObjects(ExtendedChartPart oldChart, Extend
{
var relId = dataReference.Attribute(R.id).Value;

if (oldChart.Parts.FirstOrDefault(p => p.RelationshipId == relId) is {} oldPartIdPair)
var oldPartIdPair = oldChart.Parts.FirstOrDefault(p => p.RelationshipId == relId);
if (oldPartIdPair != default)
{
switch (oldPartIdPair.OpenXmlPart)
{
Expand Down

0 comments on commit edaf9de

Please sign in to comment.