From 73cfe8c0e47ea3d4fa111e25d1e6b2b59b6b2e47 Mon Sep 17 00:00:00 2001 From: Juerd Waalboer Date: Wed, 29 Jan 2020 01:12:06 +0100 Subject: [PATCH] There is no last item in an empty list --- plugins/repeat | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/repeat b/plugins/repeat index 7742660..2374f03 100644 --- a/plugins/repeat +++ b/plugins/repeat @@ -22,7 +22,7 @@ sub command { if ($post) { return REJECT, $err_limit if $post > $limit; - return ABORT, "Can't repeat an empty transaction." if not $cart->size; + return ABORT, "Can't modify an empty transaction." if not $cart->size; return REJECT, $err_stacked if $last->multiplied; $last->quantity($post); @@ -32,12 +32,12 @@ sub command { if (not $pre and not $post) { # Lone operator. Convert withdrawal into repetition. + return ABORT, "Can't modify an empty transaction." if not $cart->size; + if ($last->has_attribute('is_withdrawal')) { $pre = abs $last->{amount}; $pre == int $pre or return REJECT, "Repeat only works on integers."; $cart->delete($last); - } elsif (not $cart->size) { - return ABORT, "Can't repeat an empty transaction."; } }