From bcaa73fa7911fa2a66fc218342486ae654bfd1e0 Mon Sep 17 00:00:00 2001 From: Patrick Lipka Date: Fri, 17 Dec 2021 10:42:18 +0100 Subject: [PATCH] Added check if active task exists before attempt to start stracking --- src/ui.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ui.cpp b/src/ui.cpp index 3dcaf23..a9fbbea 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -210,8 +210,12 @@ void command_start(std::string input, ProjectList *proj_list){ if (str.length() == 0){ // start tracking for active task - track(proj_list->active_project); - command_save(proj_list); + if (proj_list->active_project == NULL || proj_list->active_project->active_task == NULL){ + std::cout << "Project list or current project is empty. Please add projects/tasks first." << std::endl; + }else{ + track(proj_list->active_project); + command_save(proj_list); + } }else{ // change active task and start tracking int place_of_slash = str.find("/");