Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / SL / DB / Helper / AttrSorted.pm
index 77c5f19..67c4441 100644 (file)
@@ -29,7 +29,7 @@ sub _make_sorted {
 
     croak 'not an accessor' if @_ > 1;
 
-    my $next_position = (max map { $_->$position_sub // 0 } @{ $self->$unsorted_sub }) + 1;
+    my $next_position = ((max map { $_->$position_sub // 0 } @{ $self->$unsorted_sub }) // 0) + 1;
     return [
       map  { $_->[1] }
       sort { $a->[0] <=> $b->[0] }