diff options
author | PJ Fanning <fanningpj@apache.org> | 2025-01-29 13:20:25 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2025-01-29 13:20:25 +0000 |
commit | e51877f5a60635399ae068eaf1addcb060dba76c (patch) | |
tree | 14e517a4ef1293d7e15244780ca653172c7e0539 /poi-ooxml/src | |
parent | 72aa1f42a76d8c08d14d00ccca0e133e78a0091b (diff) | |
download | poi-e51877f5a60635399ae068eaf1addcb060dba76c.tar.gz poi-e51877f5a60635399ae068eaf1addcb060dba76c.zip |
fix create issue in getUnderline
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1923440 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml/src')
-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() { |