From ceffa89eb2f3231081c150ee76d1d8bc61ba0e6e Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Fri, 3 Apr 2020 19:39:03 +0200 Subject: [PATCH] Checklist: Add an extra assert --- lib/core/checklist.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/core/checklist.dart b/lib/core/checklist.dart index 93f484e8..c80b3f26 100644 --- a/lib/core/checklist.dart +++ b/lib/core/checklist.dart @@ -142,6 +142,7 @@ class Checklist { } void insertItem(int index, ChecklistItem item) { + assert(index <= items.length, "Trying to insert beyond the end"); if (index == 0) { items.insert(0, item); nodes.insert(0, item.element);