Added check if active task exists before attempt to start stracking

This commit is contained in:
Patrick Lipka 2021-12-17 10:42:18 +01:00
parent 7b7a4dcc0c
commit bcaa73fa79
1 changed files with 6 additions and 2 deletions

View File

@ -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("/");