]> source.dussan.org Git - poi.git/commitdiff
Patch from bug #52190 - null check on XWPF setFontFamily
authorNick Burch <nick@apache.org>
Wed, 16 Nov 2011 10:33:05 +0000 (10:33 +0000)
committerNick Burch <nick@apache.org>
Wed, 16 Nov 2011 10:33:05 +0000 (10:33 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1202620 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/status.xml
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRun.java

index fce325aa74b535ac572f14f5202a103d177d3f7b..ee49e67d78d585c7ac19c910c85c012b1db1cdae 100644 (file)
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.8-beta5" date="2011-??-??">
+           <action dev="poi-developers" type="fix">52190 - null check on XWPF setFontFamily</action>
            <action dev="poi-developers" type="fix">52062 - ensure that temporary files in SXSSF are deleted</action>
            <action dev="poi-developers" type="fix">50936 - Exception parsing MS Word 8.0 file (as duplicate of 47958)</action>
            <action dev="poi-developers" type="fix">47958 - ArrayIndexOutOfBoundsException from PicturesTable.getAllPictures() during Escher tree walk</action>
index e87dd0daaac7fc76948bc9e3fe5fbc509658a80a..b1d532427b2694c102243280583d3e376f392ccf 100644 (file)
@@ -91,7 +91,6 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRow;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSelection;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheet;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetCalcPr;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetData;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetFormatPr;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetPr;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetProtection;
index 4e905ec6affce810a0d7896723305e11b053dcd5..73629f7467a9d013d0700202c0508775ac5cb8c2 100644 (file)
@@ -461,7 +461,7 @@ public class XWPFRun {
      * @param fontFamily
      */
     public void setFontFamily(String fontFamily) {
-        CTRPr pr = run.getRPr();
+        CTRPr pr = run.isSetRPr() ? run.getRPr() : run.addNewRPr();
         CTFonts fonts = pr.isSetRFonts() ? pr.getRFonts() : pr.addNewRFonts();
         fonts.setAscii(fontFamily);
     }