From 348c700fedae3b0005660d8c42941fe7c69027d4 Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Sun, 22 Mar 2026 11:26:51 +0300 Subject: Handle when visited == NULL in draw_map() --- main.c | 1 - map.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/main.c b/main.c index 3b96f52..06c4e18 100644 --- a/main.c +++ b/main.c @@ -15,7 +15,6 @@ - Implement Dijkstra algorithm - Implement the A* algorithm - Implement it with 4 and 8 directions - - Add ability to see visited squares - MORE MAPS FOR THE MAP PEOPLE - Implement adding maps from files (with rle, preferably) - Implement controls (to change maps, move start/goal, etc.) diff --git a/map.c b/map.c index 3d89efc..d17c019 100644 --- a/map.c +++ b/map.c @@ -183,7 +183,7 @@ void draw_map(Map map, size_t width, size_t height, int offset_x, int offset_y, int color_pair = 0; /* The color pair of the current char */ switch (map[i][j]) { case EMPTY: - if (visited[i][j]) + if (visited != NULL && visited[i][j]) color_pair = COLOR_PAIR(VISITED_COLOR); else color_pair = COLOR_PAIR(EMPTY_COLOR); -- cgit v1.2.3