From 1feabb8895e834a2325380719aaf11053959df7a Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 7 May 2022 11:37:50 +0300 Subject: Autocommit at 07.05.2022 @ 11:37 --- src/Generic/List/List.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Generic') diff --git a/src/Generic/List/List.hpp b/src/Generic/List/List.hpp index c798590..d2a759f 100644 --- a/src/Generic/List/List.hpp +++ b/src/Generic/List/List.hpp @@ -86,7 +86,10 @@ void List::add(T element) { template void List::insertAt(T element, unsigned index) { - if (index >= count) add(element); + if (index >= count) { + add(element); + return; + } if (length == count) resize(); for (unsigned i = count; i > index; i--) -- cgit v1.3.1-26-gb76a