jezv 1 year ago
parent
commit
fc2bee4ed6
1 changed files with 6 additions and 1 deletions
  1. 6 1
      List.h

+ 6 - 1
List.h

@@ -79,8 +79,13 @@ class List
 
     virtual T pop()
     {
-        // Сделать проверку на пустой список
         T result = end->value;
+        if (end == start) {
+            end = nullptr;
+            start = nullptr;
+            lenght--;
+            return result;
+        }
         end = end->prev;
         end->next = nullptr;
         lenght--;