0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-25 13:02:51 +00:00

Check argument is a string before calling string-match

* lisp/org-html.el (org-export-as-html): Check string-match argument
(org-html-handle-time-stamps): Check string-match argument

Avoid wrong-type-argument errors during exporting.
This commit is contained in:
Bernt Hansen 2011-09-20 04:20:02 +00:00 committed by Carsten Dominik
parent aefd49b909
commit 106993d310

View file

@ -1598,7 +1598,8 @@ lang=\"%s\" xml:lang=\"%s\">
(setq line (org-html-handle-links line opt-plist)) (setq line (org-html-handle-links line opt-plist))
;; TODO items ;; TODO items
(if (and (string-match org-todo-line-regexp line) (if (and org-todo-line-regexp
(string-match org-todo-line-regexp line)
(match-beginning 2)) (match-beginning 2))
(setq line (setq line
@ -2213,19 +2214,20 @@ for further information."
"Format time stamps in string S, or remove them." "Format time stamps in string S, or remove them."
(catch 'exit (catch 'exit
(let (r b) (let (r b)
(while (string-match org-maybe-keyword-time-regexp s) (when org-maybe-keyword-time-regexp
(or b (setq b (substring s 0 (match-beginning 0)))) (while (string-match org-maybe-keyword-time-regexp s)
(setq r (concat (or b (setq b (substring s 0 (match-beginning 0))))
r (substring s 0 (match-beginning 0)) (setq r (concat
" @<span class=\"timestamp-wrapper\">" r (substring s 0 (match-beginning 0))
(if (match-end 1) " @<span class=\"timestamp-wrapper\">"
(format "@<span class=\"timestamp-kwd\">%s @</span>" (if (match-end 1)
(match-string 1 s))) (format "@<span class=\"timestamp-kwd\">%s @</span>"
(format " @<span class=\"timestamp\">%s@</span>" (match-string 1 s)))
(substring (format " @<span class=\"timestamp\">%s@</span>"
(org-translate-time (match-string 3 s)) 1 -1)) (substring
"@</span>") (org-translate-time (match-string 3 s)) 1 -1))
s (substring s (match-end 0)))) "@</span>")
s (substring s (match-end 0)))))
;; Line break if line started and ended with time stamp stuff ;; Line break if line started and ended with time stamp stuff
(if (not r) (if (not r)
s s