changeset 79462:6f9e3cd1681e

(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:41:59 +0000
parents bd1fcc60391b
children 254da12e6d98
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 08:40:20 2007 +0000
+++ b/lisp/term/x-win.el	Thu Nov 22 08:41:59 2007 +0000
@@ -2603,15 +2603,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))
 
 ;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78
 ;;; x-win.el ends here