Author: fanningpj
Date: Wed Jan 29 13:20:25 2025
New Revision: 1923440

URL: http://svn.apache.org/viewvc?rev=1923440&view=rev
Log:
fix create issue in getUnderline

Modified:
    poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java

Modified: 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java?rev=1923440&r1=1923439&r2=1923440&view=diff
==============================================================================
--- 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java 
(original)
+++ 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java 
Wed Jan 29 13:20:25 2025
@@ -523,7 +523,10 @@ public class XWPFRun implements ISDTCont
      * @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 ISDTCont
     /**
      * 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() {



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to