diff options
author | Maciej Barć <xgqt@gentoo.org> | 2023-02-03 20:50:06 +0100 |
---|---|---|
committer | Maciej Barć <xgqt@gentoo.org> | 2023-02-03 20:50:06 +0100 |
commit | 837453ec06a2f4617d688b1d5010f1576892fee9 (patch) | |
tree | 1c681fdb28aca4162250a403e8b1e592b351f71f | |
parent | elogt.el: propertize "package" and "time" (diff) | |
download | emacs-elogt-837453ec06a2f4617d688b1d5010f1576892fee9.tar.gz emacs-elogt-837453ec06a2f4617d688b1d5010f1576892fee9.tar.bz2 emacs-elogt-837453ec06a2f4617d688b1d5010f1576892fee9.zip |
elogt.el: guard vector length
Signed-off-by: Maciej Barć <xgqt@gentoo.org>
-rw-r--r-- | elogt.el | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -123,15 +123,19 @@ A logfile priority level is one of: None, Info, Warn, Error." (defun elogt--logfile-properties (file-name) "Extract the properties form given FILE-NAME." - (let* ((splitted-file-name (split-string (file-name-base file-name) ":")) - (category (car splitted-file-name)) - (package (cadr splitted-file-name)) - (time (caddr splitted-file-name))) - (vector (elogt--logfile-priority-level file-name) - category - (propertize package 'face 'bold) - (propertize time 'face 'italic) - (elogt--file-size file-name)))) + (let ((splitted-file-name (split-string (file-name-base file-name) ":"))) + (cond + ((= (length splitted-file-name) 3) + (let ((category (car splitted-file-name)) + (package (cadr splitted-file-name)) + (time (caddr splitted-file-name))) + (vector (elogt--logfile-priority-level file-name) + category + (propertize package 'face 'bold) + (propertize time 'face 'italic) + (elogt--file-size file-name)))) + (t + (make-vector 5 ""))))) (defun elogt--make-log-table-contents () "Make ElogT table contents." |