why do i get a segmentation fault when i try to print the contents of the file? how can i fix it?
int print_user(const User *user) {
    if (user == NULL) {
        return 1;
    }
    FILE *file;
    file = fopen(user->profile_pic, "r");
    char line[10];
    while (fgets(line, 10, file) != NULL) {
        printf("%s", line);
    }
    fclose(file);


    printf("Name: %s\n", (char *)user->name);
    printf("------------------------------------------\n");
    printf("Friends:\n");

    int count = 0;
    while ((char *)user->friends[count] != NULL) {
        printf("%s\n", user->friends[count]->name);
        count++;
    }
    printf("------------------------------------------\n");
    printf("Posts:\n");
    Post *curr = user->first_post;
    while (curr != NULL) {
        printf("From: %s\n", curr->author);
        printf("Date: %s\n", ctime(curr->date));
        printf("%s\n\n", curr->contents);

        if (curr->next != NULL) {
            printf("===\n\n");

        }
        curr = curr->next;
    }

    return 0;
}