Editing a task whose index not within the range crashes the program 