identify segmentation fault
int make_friends(const char *name1, const char *name2, User *head) {
    User *user1;
    User *user2;
    User *curr = head;
    while((curr != NULL) && ((user1 == NULL) || (user2 == NULL))){
        if(strcmp(curr->name, name1) == 0){
            user1 = curr;
        }
        if(strcmp(head->name, name2) == 0){
            user2 = curr;
        }
        curr = curr->next;
    }
    if ((user1 == NULL) || (user2 == NULL))
    {
        return 4;
    }
    if (strcmp(name1, name2) == 0){
        return 3;
    }
    int index1 = 0;
    int index2 = 0;
    while((index1 < MAX_FRIENDS) && (user1->friends[index1] != NULL)){
        if (user1->friends[index1] == user2)
        {
            return 1;
        }
        index1 = index1 + 1;
    }
    while((index2 < MAX_FRIENDS) && (user2->friends[index2] != NULL)){
        if (user2->friends[index2] == user1)
        {
            return 1;
        }
        index2 = index2 + 1;
    }
    if ((index1 == MAX_FRIENDS) || (index2 == MAX_FRIENDS))
    {
        return 2;
    }
    else{
        user1->friends[index1] = user2;
        user2->friends[index2] = user1;
        return 0;
    }
    
    return -1;
}