Hi,
this patch makes the NavigationFilterDemo a bit more robust. The magic caret
postion is allowed to be null, so we have to check for this case.

The ChangeLog:

2006-05-13  Robert Schuster  <[EMAIL PROTECTED]>

        * examples/gnu/classpath/examples/swing/NavigationFilterDemo.java:
        (WordFilter.getNextVisualPositionFrom): Added statement to check
        for variable pt not being null.

cya
Robert
Index: examples/gnu/classpath/examples/swing/NavigationFilterDemo.java
===================================================================
RCS file: /cvsroot/classpath/classpath/examples/gnu/classpath/examples/swing/NavigationFilterDemo.java,v
retrieving revision 1.1
diff -u -r1.1 NavigationFilterDemo.java
--- examples/gnu/classpath/examples/swing/NavigationFilterDemo.java	18 Apr 2006 20:53:34 -0000	1.1
+++ examples/gnu/classpath/examples/swing/NavigationFilterDemo.java	13 May 2006 11:45:27 -0000
@@ -160,7 +160,7 @@
           pt = text.getCaret().getMagicCaretPosition();
           
           // Calculate its position above.
-          newpos = Utilities.getPositionAbove(text, pos, pt.x);
+          newpos = Utilities.getPositionAbove(text, pos, (pt != null) ? pt.x : 0);
 
           // If we have a valid position, then calculate the next word start
           // from there.
@@ -173,7 +173,7 @@
           pt = text.getCaret().getMagicCaretPosition();
 
           // Calculate its position below.
-          newpos = Utilities.getPositionBelow(text, pos, pt.x);
+          newpos = Utilities.getPositionBelow(text, pos, (pt != null) ? pt.x : 0);
 
           // If we have a valid position, then calculate the next word start
           // from there.
@@ -192,7 +192,6 @@
           else
             return Utilities.getPreviousWord(text, newpos);
         case SwingConstants.EAST:
-          // Simply calculate the next word's start offset.
           return Utilities.getNextWord(text, newpos);
         default:
           // Do whatever the super implementation did.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to