branch: externals/pyim
commit ced34ba915cda0356eb38f4e52631f1da6cdf4e9
Author: Feng Shu <tuma...@163.com>
Commit: Feng Shu <tuma...@163.com>

    * pyim-dregcache.el (pyim-dregcache-update-iword2count): Handle orig count 
is nil.
---
 pyim-dregcache.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pyim-dregcache.el b/pyim-dregcache.el
index 18e0a8d3c0..81eea39d61 100644
--- a/pyim-dregcache.el
+++ b/pyim-dregcache.el
@@ -377,13 +377,14 @@ DICT-FILES 是词库文件列表. DICTS-MD5 是词库的MD5校验码.
 (defun pyim-dregcache-update-iword2count (word &optional wordcount-handler)
   "保存词频到缓存."
   (when pyim-debug (message "pyim-dregcache-update-iword2count. word=%s" word))
-  (let* ((orig-value (gethash word pyim-dregcache-iword2count))
+  (let* ((orig-value
+          (or (gethash word pyim-dregcache-iword2count) 0))
          (new-value (cond
                      ((functionp wordcount-handler)
                       (funcall wordcount-handler orig-value))
                      ((numberp wordcount-handler)
                       wordcount-handler)
-                     (t (+ (or orig-value 0) 1)))))
+                     (t (+ orig-value 1)))))
     (unless (equal orig-value new-value)
       (puthash word new-value pyim-dregcache-iword2count))))
 

Reply via email to