From cd8812d049a542d1f6ecf131c63ac69726f1cffc Mon Sep 17 00:00:00 2001 From: Daniela Date: Tue, 16 Apr 2019 16:29:18 +0200 Subject: [PATCH] [Assigner] cart association modified --- project/Assigner/assigner_fun.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/project/Assigner/assigner_fun.c b/project/Assigner/assigner_fun.c index 95b543d13..a4133c6cc 100644 --- a/project/Assigner/assigner_fun.c +++ b/project/Assigner/assigner_fun.c @@ -38,8 +38,11 @@ bool insert_cart(uint8_t new_req_battery, linkaddr_t mac_cart_addr) return false; } cart* c = cart_list; - while(linkaddr_cmp(&(c->cart_address),&mac_cart_addr) == 0) - c = c->next; + while(c) + { + if(linkaddr_cmp(&(c->cart_address),&mac_cart_addr) == 0) + c = c->next; + } if(c) printf("Cart already associated!\n"); else