[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/mpv edf04c18fc 3/3: Guard against nil return value
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/mpv edf04c18fc 3/3: Guard against nil return value |
Date: |
Mon, 1 Aug 2022 10:59:02 -0400 (EDT) |
branch: elpa/mpv
commit edf04c18fce5ba502d735d03751e2c5bc8ab2f27
Author: Johann Klähn <johann@jklaehn.de>
Commit: Johann Klähn <johann@jklaehn.de>
Guard against nil return value
E.g., if mpv is not running.
---
mpv.el | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/mpv.el b/mpv.el
index 309e01acbb..c96f95e47b 100644
--- a/mpv.el
+++ b/mpv.el
@@ -487,12 +487,10 @@ If ARGS are provided, they are passed as per-file options
to mpv."
(string-trim-left arg "--"))
args)
","))
- (thread-last
- (mpv-get-property "playlist-count")
- 1-
- (format "playlist/%d/filename")
- (mpv-get-property)
- (message "Added `%s' to the current playlist")))
+ (when-let* ((count (mpv-get-property "playlist-count"))
+ (index (1- count))
+ (filename (mpv-get-property (format "playlist/%d/filename"
index))))
+ (message "Added `%s' to the current playlist" filename)))
(defun mpv-playlist-append (path &rest args)
"Append the file at PATH to the current mpv playlist.