Skip to content

Commit

Permalink
Make sure PropertyNames is always populated in AddUserDefinedProperty()
Browse files Browse the repository at this point in the history
  • Loading branch information
Numpsy authored and jeremy-visionaid committed Nov 17, 2024
1 parent d5ac1d0 commit a23eecf
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions OpenMcdf.Ole/OlePropertiesContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ public OleProperty AddUserDefinedProperty(VTPropertyType vtPropertyType, string
if (this.ContainerType != ContainerType.UserDefinedProperties)
throw new InvalidOperationException();

PropertyNames ??= new();

// As per https://learn.microsoft.com/en-us/openspecs/windows_protocols/MS-OLEPS/4177a4bc-5547-49fe-a4d9-4767350fd9cf
// the property names have to be unique, and are case insensitive.
if (PropertyNames.Any(property => property.Value.Equals(name, StringComparison.InvariantCultureIgnoreCase)))
Expand Down

0 comments on commit a23eecf

Please sign in to comment.