You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by no...@apache.org on 2011/06/01 16:28:11 UTC

svn commit: r1130159 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinParagraphView.java

Author: noelgrandin
Date: Wed Jun  1 14:28:11 2011
New Revision: 1130159

URL: http://svn.apache.org/viewvc?rev=1130159&view=rev
Log:
fix NPE on startup of TextPaneDemo

Modified:
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinParagraphView.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinParagraphView.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinParagraphView.java?rev=1130159&r1=1130158&r2=1130159&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinParagraphView.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinParagraphView.java Wed Jun  1 14:28:11 2011
@@ -374,21 +374,23 @@ class TextPaneSkinParagraphView extends 
         if (offset == getCharacterCount() - 1) {
             characterBounds = terminatorBounds;
         } else {
-            for (int i = 0, n = rows.getLength(); i < n; i++) {
-                Row row = rows.get(i);
-                for (RowSegment segment : row.rowSegments) {
-                    int nodeViewOffset = segment.offset;
-                    int characterCount = segment.nodeView.getCharacterCount();
-
-                    if (offset >= nodeViewOffset
-                        && offset < nodeViewOffset + characterCount) {
-                        characterBounds = segment.nodeView.getCharacterBounds(offset - nodeViewOffset);
+            if (rows != null) {
+                for (int i = 0, n = rows.getLength(); i < n; i++) {
+                    Row row = rows.get(i);
+                    for (RowSegment segment : row.rowSegments) {
+                        int nodeViewOffset = segment.offset;
+                        int characterCount = segment.nodeView.getCharacterCount();
+
+                        if (offset >= nodeViewOffset
+                            && offset < nodeViewOffset + characterCount) {
+                            characterBounds = segment.nodeView.getCharacterBounds(offset - nodeViewOffset);
+
+                            if (characterBounds != null) {
+                                characterBounds = characterBounds.translate(segment.nodeView.getX(), segment.nodeView.getY());
+                            }
 
-                        if (characterBounds != null) {
-                            characterBounds = characterBounds.translate(segment.nodeView.getX(), segment.nodeView.getY());
+                            break;
                         }
-
-                        break;
                     }
                 }
             }