Revision: 6120
Author: iratqq
Date: Mon Dec 14 02:29:35 2009
Log: * scm/sj3.scm (sj3-lib-get-nth-candidate):
  - Check underflow of nth.

http://code.google.com/p/uim/source/detail?r=6120

Modified:
 /trunk/scm/sj3.scm

=======================================
--- /trunk/scm/sj3.scm  Mon Dec  7 02:48:20 2009
+++ /trunk/scm/sj3.scm  Mon Dec 14 02:29:35 2009
@@ -121,7 +121,8 @@
 (define (sj3-lib-get-nth-candidate sc seg nth)
   (let* ((yomi (sj3-get-nth-yomi sc seg))
          (cnt (sj3-lib-funcall sc sj3-lib-douoncnt yomi)))
-    (if (< nth cnt)
+    (if (and (< nth cnt)
+             (<= 0 nth))
         (car (sj3-lib-funcall sc sj3-lib-get-nth-douon yomi nth))
         (list-ref (sj3-make-map-from-kana-string yomi) (- nth cnt)))))
 (define (sj3-lib-release-context sc)

Reply via email to