Created attachment 36428 [details] A test case to reproduce the issue Please find a reproducer in attachment. This is with Java 11 and POI 4.0.1. The stack trace is: Exception in thread "main" java.lang.NullPointerException at org.apache.poi.hssf.record.common.UnicodeString.swapFontUse(UnicodeString.java:676) at org.apache.poi.hssf.usermodel.HSSFOptimiser.optimiseFonts(HSSFOptimiser.java:155) at ... The problem is fairly obvious: the line loops over the elements of field_4_format_runs without doing a null-check on it first.
fix applied in https://svn.apache.org/viewvc?view=revision&revision=1853859