Skip to content

Commit

Permalink
[Fix] UserContent tag bug
Browse files Browse the repository at this point in the history
Array index out of bounds exception.
  • Loading branch information
ohaegi committed Jan 16, 2017
1 parent 5a91345 commit dd2dd8e
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,17 @@ private XmlToken getXmlWithOuputId(String xmlText) throws XmlException {
* userContent EObject
* @return true if userContent content begin by a paragraph
*/
@SuppressWarnings("deprecation")
private boolean userDocContentIsFirstRunOfParagraph(UserContent userContent) {
XWPFRun userContentFirstRun = userContent.getSubConstructs().get(0).getRuns().get(0);
@SuppressWarnings("deprecation")
XWPFRun paragraphFirstRun = userContentFirstRun.getParagraph().getRuns().get(0);
return userContentFirstRun == paragraphFirstRun;
boolean result = true;
if (userContent.getSubConstructs().size() > 0 && userContent.getSubConstructs().get(0).getRuns().size() > 0) {
XWPFRun userContentFirstRun = userContent.getSubConstructs().get(0).getRuns().get(0);
if (userContentFirstRun.getParagraph() != null && userContentFirstRun.getParagraph().getRuns().size() > 0) {
XWPFRun paragraphFirstRun = userContentFirstRun.getParagraph().getRuns().get(0);
result = userContentFirstRun == paragraphFirstRun;
}
}
return result;
}

/**
Expand Down

0 comments on commit dd2dd8e

Please sign in to comment.