aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Barć <xgqt@gentoo.org>2023-02-03 20:50:06 +0100
committerMaciej Barć <xgqt@gentoo.org>2023-02-03 20:50:06 +0100
commit837453ec06a2f4617d688b1d5010f1576892fee9 (patch)
tree1c681fdb28aca4162250a403e8b1e592b351f71f
parentelogt.el: propertize "package" and "time" (diff)
downloademacs-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.el22
1 files changed, 13 insertions, 9 deletions
diff --git a/elogt.el b/elogt.el
index f5d7fd9..a067747 100644
--- a/elogt.el
+++ b/elogt.el
@@ -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."