From 4ec86bbc1d2dbd5a619fe8a7b23771a5eca5f5ac Mon Sep 17 00:00:00 2001 From: gongg21 Date: Sat, 23 Sep 2023 23:21:47 +0800 Subject: [PATCH] Update TaskList.java find method was updated to fix bug. --- src/main/java/gbot/TaskList.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/gbot/TaskList.java b/src/main/java/gbot/TaskList.java index 1785467b57..af361e2e7d 100644 --- a/src/main/java/gbot/TaskList.java +++ b/src/main/java/gbot/TaskList.java @@ -197,10 +197,11 @@ public String deleteAllTasks() { * @param keyword The keyword given by user. */ public String find(String keyword) { + assert keyword != null; ArrayList matchList = new ArrayList<>(); for (int i = 0; i < taskCount; i++) { Task curr = list.get(i); - if (curr.getDescription().toLowerCase().contains(keyword)) { + if (curr.getDescription().toLowerCase().contains(keyword.strip())) { matchList.add(curr); } }