From 058fae71a26144536195f6aedea9fcb3fcea6007 Mon Sep 17 00:00:00 2001 From: Anton Dolozin Date: Wed, 5 Nov 2025 00:01:07 +0100 Subject: [PATCH] Still fixing adding error --- du5/a_station.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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;