Skip to content

Commit 38801b8

Browse files
committed
Fix position validation in getTasksByCategoryPositionFromApi method
1 parent 92939fd commit 38801b8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/helpers/task.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ export class Task {
318318

319319
async getTasksByCategoryPositionFromApi(position: number): Promise<task[]> {
320320
if(!navigator.onLine) throw new Error("No internet connection");
321+
if (position < 0) position = 0;
321322
const taskCategory = this.tasksCategoryList.get()[position];
322323
if (!taskCategory) throw new Error("Task category not found");
323324
const url = `${this.baseUrl}/lists/${taskCategory.id}/tasks`;

0 commit comments

Comments
 (0)