changeset 86308:2a94c16792c6

(x-gtk-map-stock): Check if FILE is a string.
author Jan Djärv <jan.h.d@swipnet.se>
date Thu, 22 Nov 2007 08:35:20 +0000
parents ae9d728a4db2
children dfa2dd8a3423
files lisp/term/x-win.el
diffstat 1 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/term/x-win.el	Thu Nov 22 07:15:14 2007 +0000
+++ b/lisp/term/x-win.el	Thu Nov 22 08:35:20 2007 +0000
@@ -2672,15 +2672,18 @@
 
 (defun x-gtk-map-stock (file)
   "Map icon with file name FILE to a Gtk+ stock name, using `x-gtk-stock-map'."
-  (let* ((file-sans (file-name-sans-extension file))
-	 (key (and (string-match "/\\([^/]+/[^/]+/[^/]+$\\)" file-sans)
-		   (match-string 1 file-sans)))
-	 (value))
-    (mapc (lambda (elem)
-	    (let ((assoc (if (symbolp elem) (symbol-value elem) elem)))
-	      (or value (setq value (assoc-string (or key file-sans) assoc)))))
-	    icon-map-list)
-    (and value (cdr value))))
+  (if (stringp file)
+      (let* ((file-sans (file-name-sans-extension file))
+	     (key (and (string-match "/\\([^/]+/[^/]+/[^/]+$\\)" file-sans)
+		       (match-string 1 file-sans)))
+	     (value))
+	(mapc (lambda (elem)
+		(let ((assoc (if (symbolp elem) (symbol-value elem) elem)))
+		  (or value (setq value (assoc-string (or key file-sans)
+						      assoc)))))
+	      icon-map-list)
+	(and value (cdr value)))
+    nil))
 
 (provide 'x-win)