incubator-odf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From devin...@apache.org
Subject svn commit: r1180784 - /incubator/odf/trunk/simple/src/main/java/org/odftoolkit/simple/text/Span.java
Date Mon, 10 Oct 2011 05:35:32 GMT
Author: devinhan
Date: Mon Oct 10 05:35:31 2011
New Revision: 1180784

URL: http://svn.apache.org/viewvc?rev=1180784&view=rev
Log:
#ODFTOOLKIT-288# No null check for lastNode in setTextContent of Span class.[Developer:Oliver
Rau,Devin;Reviewer:Devin]

Modified:
    incubator/odf/trunk/simple/src/main/java/org/odftoolkit/simple/text/Span.java

Modified: incubator/odf/trunk/simple/src/main/java/org/odftoolkit/simple/text/Span.java
URL: http://svn.apache.org/viewvc/incubator/odf/trunk/simple/src/main/java/org/odftoolkit/simple/text/Span.java?rev=1180784&r1=1180783&r2=1180784&view=diff
==============================================================================
--- incubator/odf/trunk/simple/src/main/java/org/odftoolkit/simple/text/Span.java (original)
+++ incubator/odf/trunk/simple/src/main/java/org/odftoolkit/simple/text/Span.java Mon Oct
10 05:35:31 2011
@@ -162,12 +162,12 @@ public class Span extends Component impl
 	public void setTextContent(String content) {
 		Paragraph.removeTextContentImpl(getOdfElement());
 		Node lastNode = getOdfElement().getLastChild();
-		if (lastNode.getNodeName() != null && lastNode.getNodeName().equals("text:a"))
{
-			if (content != null && !content.equals(""))
+		if (content != null && !content.equals("")){
+			if (lastNode != null && lastNode.getNodeName() != null && lastNode.getNodeName().equals("text:a"))
{
 				Paragraph.appendTextElements((TextAElement) lastNode, content, true);
-		} else {
-			if (content != null && !content.equals(""))
+			} else {
 				Paragraph.appendTextElements(getOdfElement(), content, true);
+			}
 		}
 		// remove empty hyperlink
 		Paragraph.removeEmptyHyperlink(getOdfElement());



Mime
View raw message