why is line 47 causing a segmentation fault
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "pmake.h"

#include <ctype.h>

/* Read from the open file fp, and create the linked data structure
   that represents the Makefile contained in the file.
   See the top of pmake.h for the specification of Makefile contents.
 */
Rule *parse_file(FILE *fp) {
    // File is already opened for reading
    char line[MAXLINE];


    while (fgets(line, MAXLINE, fp)) {
        //Check if line is only white space and skip
        int all_white = 1;
        for (int i = 0; i < strlen(line); i++) {
            if (!isspace(line[i])) {
                all_white = 0;
            }     
        }
        if (all_white) {
            continue;
        }
        
        // Check if line is a comment and skip
        if (is_comment_or_empty(line)) {
            continue;
        }
        
        char str[] = " ";
        char *token = strtok(line, str);

        printf("|%s|", token);

        char first = *token;
        // Check if line is a target line
        if (isalpha(first)) {
            printf("Target: ");
            Rule *curr_rule;

            // First argument must be a target
            curr_rule -> target = token;
            
            // Second argument is a colon

            // Subsequent arguments are dependencies if any exists
            while (token != NULL) {
                printf("%s ", token);

                token = strtok(NULL, str);
            }
        }

        // Check if line is an action line
        if (first == '\t') {
            printf("Action: ");

            while (token != NULL) {
                printf("%s ", token);

                token = strtok(NULL, str);
            }
        }

        printf("---------------NEXT LINE-------------\n");

        // printf("%s", line);
    }
    return 0;
}

/* Return 1 if the line is a comment line, as defined on the assignment handout.
   Return 0 otherwise.
 */
int is_comment_or_empty(const char *line) {
    for (int i = 0; i < strlen(line); i++){
        if (line[i] == '#') {
            return 1;
        }
        if (line[i] != '\t' && line[i] != ' ') {
            return 0;
        }
    }
    return 1;
}
