From a4e02b775fed4f3635acbca8578b464466876dd9 Mon Sep 17 00:00:00 2001 From: vj586da Date: Thu, 4 Nov 2021 20:14:54 +0100 Subject: [PATCH] clear train --- cv4/a_train.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cv4/a_train.c b/cv4/a_train.c index 290ed95..db20e3a 100755 --- a/cv4/a_train.c +++ b/cv4/a_train.c @@ -40,6 +40,9 @@ void cancel_train(struct car* first) { struct car* clear_train(struct car* first, const char* target) { struct car* this = first; + if (this == NULL){ + return NULL; + } while( this->next->next != NULL){ if(strcmp(this->value, target) == 0){ this->next == this->next->next;