# HG changeset patch # User Lute Kamstra # Date 1108138129 0 # Node ID 253d4187af2d0109828c0d55e891a8943a09f9c1 # Parent 6f0850608427c5d36e7f476b754e9b351b1e3562 (apropos-score-doc): Prevent division by zero. diff -r 6f0850608427 -r 253d4187af2d lisp/apropos.el --- a/lisp/apropos.el Fri Feb 11 06:03:35 2005 +0000 +++ b/lisp/apropos.el Fri Feb 11 16:08:49 2005 +0000 @@ -1,6 +1,6 @@ ;;; apropos.el --- apropos commands for users and programmers -;; Copyright (C) 1989,94,1995,2001,02,03,2004 Free Software Foundation, Inc. +;; Copyright (C) 1989,94,1995,2001,02,03,04,2005 Free Software Foundation, Inc. ;; Author: Joe Wells ;; Rewritten: Daniel Pfeiffer @@ -322,13 +322,13 @@ (defun apropos-score-doc (doc) "Return apropos score for documentation string DOC." - (if doc - (let ((score 0) - (l (length doc)) - i) - (dolist (s (apropos-calc-scores doc apropos-all-words) score) - (setq score (+ score 50 (/ (* (- l s) 50) l))))) - 0)) + (let ((l (length doc))) + (if (> l 0) + (let ((score 0) + i) + (dolist (s (apropos-calc-scores doc apropos-all-words) score) + (setq score (+ score 50 (/ (* (- l s) 50) l))))) + 0))) (defun apropos-score-symbol (symbol &optional weight) "Return apropos score for SYMBOL."