diff --git a/du5/a_station.c b/du5/a_station.c index caaba3b..6e4929c 100644 --- a/du5/a_station.c +++ b/du5/a_station.c @@ -60,8 +60,14 @@ void add_target_capacity(struct station* station,const char* target, int capacit struct car* next = (struct car*)calloc(1, sizeof(struct car)); strcpy(next->value, target); next->capacity = capacity; - ptr->next = next; - return; + if(ptr){ + ptr->next = next; + return;} + else{ + *station->tracks = next; + return; + } + } int new_cap = ptr->capacity + capacity;