diff --git a/du5/a_station.c b/du5/a_station.c index 09005c2..9a3bec1 100644 --- a/du5/a_station.c +++ b/du5/a_station.c @@ -85,7 +85,7 @@ int get_target_capacity(struct station* station,const char* target){ } ptr = ptr->next; - /* code */ + } return 0; } @@ -97,11 +97,12 @@ int count_targets(struct station* station){ int count_capacity(struct station* station){ int res = 0; struct car* ptr = *station->tracks; - while (ptr){ + while (ptr && ptr->next){ res += ptr->capacity; ptr = ptr->next; } + res += ptr->capacity; return res; }