how do i stop segmentation faults when deleting the first node in the linked list
int delete_user(const char *name, User **user_ptr_del) {
    if (find_user(name, *user_ptr_del) == NULL) {
        return 1;
    }

    User *curr = *user_ptr_del;
    char *friend_name;
    while (curr != NULL) {
        for (int i = 0; i < MAX_FRIENDS; i++) {
            friend_name = (curr->friends)[i]->name;
            if (friend_name != NULL) {
                if (strcmp(friend_name, name) == 0) {
                    (curr->friends)[i] = NULL;
                }
            }
        }
        curr = curr->next;
    }
    
    curr = *user_ptr_del;
    //traverses curr to the node before the user to be deleted
    while (curr->next != NULL) {
        if (strcmp((curr->next)->name, name) == 0) {
            break;
        }
        curr = curr->next;
    }
    free(curr->next);
    curr->next = (curr->next)->next;

    return 0;
}