There is no last item in an empty list
This commit is contained in:
parent
a0eafa21f5
commit
73cfe8c0e4
1 changed files with 3 additions and 3 deletions
|
@ -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.";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue