aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-07-16 10:39:26 +0200
committerRobin Jarry <robin@jarry.cc>2023-07-17 10:23:28 +0200
commit21f14c550a44a4b9207ca27b81976f92a7d26784 (patch)
treeb840bbb5396d4dd26a9611ef508d0ad8382991df
parenta608f0331a4874ce813d9ec3a215560e1653fafe (diff)
downloadaerc-21f14c550a44a4b9207ca27b81976f92a7d26784.tar.gz
send: return error when recipients list is empty
Avoid sending messages with no recipients. Fixes: https://todo.sr.ht/~rjarry/aerc/182 Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
-rw-r--r--commands/compose/send.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/commands/compose/send.go b/commands/compose/send.go
index 7eeb124c..e53b01a3 100644
--- a/commands/compose/send.go
+++ b/commands/compose/send.go
@@ -79,6 +79,9 @@ func (Send) Execute(aerc *widgets.Aerc, args []string) error {
if err != nil {
return errors.Wrap(err, "listRecipients")
}
+ if len(rcpts) == 0 {
+ return errors.New("Cannot send message with no recipients")
+ }
uri, err := url.Parse(outgoing)
if err != nil {