FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix the handling of missing CodePage properties by Numpsy · Pull Request #428 · openmcdf/openmcdf · GitHub

Fix the handling of missing CodePage properties - #428

Merged
jeremy-visionaid merged 1 commit into
openmcdf:mainfrom
Numpsy:fix_null_codepage
May 3, 2026
Merged

jeremy-visionaid merged 1 commit into
openmcdf:mainfrom
Numpsy:fix_null_codepage

Conversation

Numpsy commented May 3, 2026

Copy link
Copy Markdown
Contributor

…ntext

And add a new unit test for the property being missing.

I apparently broke this when PropertyIdentifierAndOffset was made a struct, as FirstOrDefault returns an empty value instead of null when its missing, which caused it to think the property exists with an offset of zero.

This fixes that by using FindIndex instead of FirstOrDefault, and also adds a new test file which has no codepage property present, and a new unit test which tests that reading the summary information from that file results in the expected error.

(None of the existing tests caught this because all of them have a code page property present)

…ntext

And add a new unit test for the property being missing.

I apparently broke this when PropertyIdentifierAndOffset was made a struct, as FirstOrDefault returns an empty value instead of null when its missing, which caused it to think the property exists with an offset of zero.
This fixes that by using FindIndex instead of FirstOrDefault, and also adds a new test file which has no codepage property present, and a new unit test which tests that reading the summary information from that file results in the expected error.

Numpsy commented May 3, 2026

Copy link
Copy Markdown
Contributor Author

I hit this when updating https://github.com/openmcdf/openmcdf/pull/407/changes, where there are no code pages in the HWP documents

jeremy-visionaid changed the title Fix the handling of missing CodePage properties in PropertySet.LoadCo… Fix the handling of missing CodePage properties May 3, 2026
jeremy-visionaid merged commit e06c107 into openmcdf:main May 3, 2026
2 checks passed
Numpsy deleted the fix_null_codepage branch May 3, 2026 22:57
This was referenced May 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL