why am i getting a segmentation fault

int make_friends(const char *name1, const char *name2, User *head) {
    if (strcmp(name1, name2) == 0) {
        return 3;
    }

    User *user1 = find_user(name1, head);
    User *user2 = find_user(name2, head);

    if (user1 == NULL || user2 == NULL) {
        return 4;
    }

    int u1_friends_w_u2 = 0;
    int u1_friend_counter = 0;
    int u2_friends_w_u1 = 0;
    int u2_friend_counter = 0; 

    for (int i = 0; i < 10; i++) {
        if (user1->friends[i] == user2) {
            u1_friends_w_u2 = 1;
        } else if (user1->friends[i] != NULL) {
            u1_friend_counter++;
        }
    }

    for (int i = 0; i < 10; i++) {
        if (user2->friends[i] == user1) {
            u2_friends_w_u1 = 1;
        } else if (user2->friends[i] != NULL) {
            u2_friend_counter++;
        }
    }

    if (u1_friends_w_u2 == 1 && u2_friends_w_u1 == 1) {
        return 1;
    }

    // By now the check for if they are already friends has happened, so this should test not friends and if at max capcity
    if (u1_friend_counter == 10 || u2_friend_counter == 10) {
        return 2;
    }

    for (int i = 0; i < 10; i++) {
        if (user1->friends[i] == NULL) {
            user1->friends[i] = user2;
            break;
        }
    }

    for (int i = 0; i < 10; i++) {
        if (user2->friends[i] == NULL) {
            user2->friends[i] = user1;
            break;
        }
    }

    return 0;
}