From 9e1165c24a8546d9472ef0cd1f1a9cf959013274 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Tue, 14 Feb 2012 12:56:30 +0000 Subject: [PATCH] Apply patch from bug #52662 - CharacterRun NPE fix when fetching symbol fonts, where no fonts are defined git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1243907 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/status.xml | 1 + .../src/org/apache/poi/hwpf/usermodel/CharacterRun.java | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index e4022e7a64..a0816adfcf 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 52662 - CharacterRun NPE fix when fetching symbol fonts, where no fonts are defined 52658 - support mergin table cells in XSLF validate row number and column index in SXSSF when creating new rows / cells 51498 - fixed evaluation of blank cells in COUNTIF diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java index 61be15b668..d049969f75 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java @@ -606,8 +606,13 @@ public final class CharacterRun public Ffn getSymbolFont() { if (isSymbol()) { + if (_doc.getFontTable() == null) + return null; + + // Fetch all font names Ffn[] fontNames = _doc.getFontTable().getFontNames(); + // Try to find the name of the font for our symbol if (fontNames.length <= _props.getFtcSym()) return null;