From 441c441ac87fc573d1e7a4cf266b9d1664486793 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 e4022e7a6..a0816adfc 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 61be15b66..d049969f7 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;