diff --git a/du6/a_station.c b/du6/a_station.c index be738ec..c3b73f8 100644 --- a/du6/a_station.c +++ b/du6/a_station.c @@ -20,7 +20,7 @@ void destroy_station(struct station* station) for (int i = 0; i < station->track_count; i++) { struct car* currentTracks = station->tracks[i]; - while (currentTracks->next != NULL) + while (currentTracks != NULL) { struct car* tempTrack = currentTracks; currentTracks = currentTracks->next; @@ -78,8 +78,8 @@ void add_target_capacity(struct station* station,const char* target, int capacit newCar->capacity = capacity; //vlozi na zaciatok tracku - new_car->next = station->tracks[i]; - station->tracks[i] = new_car; + newCar->next = station->tracks[i]; + station->tracks[i] = newCar; } int get_target_capacity(struct station* station,const char* target)