nissl-lab / npoi

a .NET library that can read/write Office formats without Microsoft Office installed. No COM+, no interop.
Apache License 2.0
5.73k stars 1.43k forks source link

POI Bug 66425: OnDocumentRead()@XWPFDocument can throw an excepiton. #1222

Closed tohidemyname closed 10 months ago

tohidemyname commented 11 months ago

NPOI Version

master

The bug was reported to POI. The patch is as follows: https://github.com/apache/poi/commit/0654bf9d87da525765eaba7a8e7242a05c48ee02

The method of POI is as follows:

protected void onDocumentRead() throws IOException { ... if (doc.getDocument().getBody().getSectPr() != null) { ... }} The above patch fixed the check:

if (doc.getDocument().getBody() != null && doc.getDocument().getBody().getSectPr() != null) {

In NPOI, the method is as follows: internal override void OnDocumentRead(){ ... if (doc.Document.body.sectPr != null) ... It should have the identical bug.