From d5be4a267ef8ebb739b70a66e002e902eb02bb8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Nut=CC=A6iu?= Date: Wed, 21 Dec 2016 17:28:44 +0200 Subject: [PATCH] Update list.c --- extra/DSA/lists.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/extra/DSA/lists.c b/extra/DSA/lists.c index 3754205..7098db8 100644 --- a/extra/DSA/lists.c +++ b/extra/DSA/lists.c @@ -118,7 +118,13 @@ void modify_party(Party party, const char * name, const char * symbol) { void move_candidate(Party head, Party new_party, const char * name) { Party current_party = search_candidate(head, name); + if (current_party == NULL) { + return; + } Member candidate = get_canditate(current_party, name); + if ( candidate == NULL ) { + return; + } Member copy = new_candidate(candidate->name, candidate->age, candidate->convicted); delete_candidate(current_party, name); @@ -224,9 +230,9 @@ int main(void) { // delete_candidate(head, "bran"); // delete_candidate(head, "Tyrion"); // delete_candidate_list(head); - move_candidate(head, targaryan, "Ed"); + // move_candidate(head, targaryan, "Ed"); + // move_candidate(head, targaryan, "nume"); - print_all(head); print_all(head); return EXIT_SUCCESS; }