why am i getting a segmentation fault?
int print_user(const User *user) {
    if (user == NULL) {
        return 1; // returns 1 if user pointer is null
    }

    FILE *profile_picture;
    profile_picture = fopen(user->profile_pic, "r");
    Post *user_posts_curr = user -> first_post; // saves the head of the user's posts linked list

    if (profile_picture != NULL) {
        char buffer[100];
        while (fgets(buffer, 100, profile_picture) != NULL) {
            printf("%s", buffer); // printing chunks of profile picture ascii one by one
        }
        fclose(profile_picture);
    }

    printf("\nName: %s"
           "\n------------------------------------------"
           "\nFriends:\n",
           user->name);

    // looping through friends list to print names
    int friend_index;
    for (friend_index = 0; friend_index < MAX_FRIENDS; friend_index++) {
        if ((user->friends)[friend_index] == NULL) {
            continue; // if we come across an empty index in the friends list, skip index and do not print
        }
        printf("%s\n", ((user->friends)[friend_index]->name));
    }

    printf("------------------------------------------"
           "\nPosts\n");
    // looping through the user's posts
    while (user_posts_curr->next != NULL) {
        printf("From: %s"
               "\nDate: %s"
               "\n%s"
               "\n\n===\n\n",
               user_posts_curr->author, ctime(user_posts_curr->date), user_posts_curr->contents);
        // we print each line with a equal barrier "===" as long as there is a next post to divide
        user_posts_curr = user_posts_curr->next;
    }
    printf("From: %s"
           "\nDate: %s"
           "\n%s"
           "\n------------------------------------------",
           user_posts_curr->author, ctime(user_posts_curr->date), user_posts_curr->contents);
    // when there is no next post, as seen on sample_output, we close the section off with a full barrier, not "==="

    return 0;
}