Fixed prefix results when the prefix matches a word.
authorviric@mandarina
Sun, 29 Jul 2007 21:26:49 +0200
changeset 21 0739404e26dc
parent 20 2f815ca5cb8c
child 22 41c03c688d65
Fixed prefix results when the prefix matches a word.
src/jdict/DictIndex.java
--- a/src/jdict/DictIndex.java	Sun Jul 29 21:24:34 2007 +0200
+++ b/src/jdict/DictIndex.java	Sun Jul 29 21:26:49 2007 +0200
@@ -398,14 +398,18 @@
             }
         } while (step > 0);
 
-        /* Replace pivot for prefixes */
-        try {
-            in.seekFromStart(pivot);
-        } catch (IOException e)
+        /* If we didn't find a word, replace the pivot */
+        if (results.size() == 0)
         {
-            System.out.println("Seek from start error");
-            return results;
+            try {
+                in.seekFromStart(pivot);
+            } catch (IOException e)
+            {
+                System.out.println("Seek from start error");
+                return results;
+            }
         }
+
         readUntilNewLine();
 
         /* Add the prefixes */