From a0b35c3a8f18172bcfac96d47a74ec13b97a2ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Vl=C4=8Dek?= Date: Thu, 23 Apr 2026 22:50:43 +0000 Subject: [PATCH] Aktualizovat du6/a_station.c --- du6/a_station.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/du6/a_station.c b/du6/a_station.c index a66ad89..5e6dda3 100644 --- a/du6/a_station.c +++ b/du6/a_station.c @@ -103,13 +103,20 @@ int get_target_capacity(struct station* station,const char* target) int count_targets(struct station* station) { + if (station == NULL) + { + return 0; + } + int count = 0; for (int i = 0; i < station->track_count; i++) { struct car* currentTracks = station->tracks[i]; - while (currentTracks->next->value != NULL && currentTracks->next != NULL) + // while (currentTracks->next->value != NULL && currentTracks->next != NULL) + while (currentTracks != NULL) { count += 1; + currentTracks = currentTracks->next; } } return count;