diff options
-rw-r--r-- | poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java index ca95740fe8..e7eb8576f7 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java @@ -523,7 +523,10 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { * @return The underline, or null create is false and there is no underline. */ private CTUnderline getCTUnderline(boolean create) { - CTRPr pr = getRunProperties(true); + CTRPr pr = getRunProperties(create); + if (pr == null) { + return null; + } return pr.sizeOfUArray() > 0 ? pr.getUArray(0) : (create ? pr.addNewU() : null); } @@ -582,7 +585,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { /** * Get the underline color for the run's underline, if any. * - * @return The RGB color value as as a string of hexadecimal digits (e.g., "A0B2F1") or "auto". + * @return The RGB color value as a string of hexadecimal digits (e.g., "A0B2F1") or "auto". * @since 4.0.0 */ public String getUnderlineColor() { |