Author: rwhitcomb
Date: Thu Feb 18 16:15:57 2021
New Revision: 1886667

URL: http://svn.apache.org/viewvc?rev=1886667&view=rev
Log:
Tweak the "selectWord" method in CharUtils.

Modified:
    pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java

Modified: pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java?rev=1886667&r1=1886666&r2=1886667&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java Thu Feb 18 
16:15:57 2021
@@ -41,11 +41,12 @@ public final class CharUtils {
      * cannot be made (which could be because the input sequence is {@code 
null}).
      */
     public static CharSpan selectWord(final CharSequence sequence, final int 
start) {
-        if (sequence == null) {
+        int length = sequence.length();
+
+        if (sequence == null || length == 0) {
             return null;
         }
 
-        int length = sequence.length();
         int adjustedStart = start;
         char ch;
 


Reply via email to