From 55035ad8b28b407f39def5c2b139a29e7e182958 Mon Sep 17 00:00:00 2001 From: Sören Tempel Date: Sun, 12 Jan 2020 16:34:55 +0100 Subject: mcom: check if a draft was found when invoking `mcom -r` Without this patch `mcom -r` would invoke $EDITOR on a directory if the maildir did not contain any drafts. To prevent this from happening, check if a draft was found before performing any further processing. If not, terminate mcom with an error message. Closes: #169 [via git-merge-pr] --- mcom | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'mcom') diff --git a/mcom b/mcom index e0aeaf7..3658dcb 100755 --- a/mcom +++ b/mcom @@ -250,6 +250,11 @@ else draftmime="$(printf '%s\n' "$draft" | sed 's,\(.*\)/cur/,\1/tmp/mime-,')" fi +if [ -n "$resume" ] && [ -z "$draft" ]; then + echo "mcom: no draft found" + exit 1 +fi + [ -z "$resume" ] && { case "$0" in -- cgit 1.4.1