From cc1de9aa119f8e20d53d7e22acd565b22db56ea0 Mon Sep 17 00:00:00 2001 From: Antony Liu Date: Wed, 13 Mar 2024 14:06:33 +0800 Subject: [PATCH] poi: bug 60288: remove defensive copy for internal relationships. Patch from Tim Helmstedt. --- openxml4Net/OPC/OPCPackage.cs | 2 +- openxml4Net/OPC/PackagePart.cs | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/openxml4Net/OPC/OPCPackage.cs b/openxml4Net/OPC/OPCPackage.cs index 2704f5305..327fb58e0 100644 --- a/openxml4Net/OPC/OPCPackage.cs +++ b/openxml4Net/OPC/OPCPackage.cs @@ -1548,7 +1548,7 @@ public bool HasRelationships */ public bool IsRelationshipExists(PackageRelationship rel) { - foreach (PackageRelationship r in this.Relationships) + foreach (PackageRelationship r in relationships) { if (r == rel) return true; diff --git a/openxml4Net/OPC/PackagePart.cs b/openxml4Net/OPC/PackagePart.cs index 75b0463ba..9941ea20d 100644 --- a/openxml4Net/OPC/PackagePart.cs +++ b/openxml4Net/OPC/PackagePart.cs @@ -473,17 +473,10 @@ public bool HasRelationships */ public bool IsRelationshipExists(PackageRelationship rel) { - try + foreach (PackageRelationship r in _relationships) { - foreach (PackageRelationship r in this.Relationships) - { - if (r == rel) - return true; - } - } - catch (InvalidFormatException) - { - + if (r == rel) + return true; } return false; }