Skip to content

Commit e51877f

Browse files
committed
fix create issue in getUnderline
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1923440 13f79535-47bb-0310-9956-ffa450edef68
1 parent 72aa1f4 commit e51877f

File tree

1 file changed

+5
-2
lines changed
  • poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,10 @@ public void setUnderline(UnderlinePatterns value) {
523523
* @return The underline, or null create is false and there is no underline.
524524
*/
525525
private CTUnderline getCTUnderline(boolean create) {
526-
CTRPr pr = getRunProperties(true);
526+
CTRPr pr = getRunProperties(create);
527+
if (pr == null) {
528+
return null;
529+
}
527530
return pr.sizeOfUArray() > 0 ? pr.getUArray(0) : (create ? pr.addNewU() : null);
528531
}
529532

@@ -582,7 +585,7 @@ public STThemeColor.Enum getUnderlineThemeColor() {
582585
/**
583586
* Get the underline color for the run's underline, if any.
584587
*
585-
* @return The RGB color value as as a string of hexadecimal digits (e.g., "A0B2F1") or "auto".
588+
* @return The RGB color value as a string of hexadecimal digits (e.g., "A0B2F1") or "auto".
586589
* @since 4.0.0
587590
*/
588591
public String getUnderlineColor() {

0 commit comments

Comments
 (0)