aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Petrashin <kirill8201@yandex.ru>2026-03-22 11:26:51 +0300
committerKirill Petrashin <kirill8201@yandex.ru>2026-03-22 11:26:51 +0300
commit348c700fedae3b0005660d8c42941fe7c69027d4 (patch)
tree340838f365d5084a6f025fe665426504c3fcf489
parentb0b6aecd5cb3a9a02376ec071699f827feee6934 (diff)
Handle when visited == NULL in draw_map()
-rw-r--r--main.c1
-rw-r--r--map.c2
2 files changed, 1 insertions, 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);