aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_map.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ft_get_map.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ft_get_map.c b/src/ft_get_map.c
index a57e32e..735e31e 100644
--- a/src/ft_get_map.c
+++ b/src/ft_get_map.c
@@ -27,7 +27,8 @@ ft_check_err(char *line, size_t size)
size_t i;
i = 1;
- if (ft_strlen(line) != size)
+ if (ft_strlen(line) != size || line[0] != '1'
+ || line[ft_strlen(line) - 1] != '1')
return (-1);
while (i < ft_strlen(line) && line[i])
{
@@ -83,7 +84,7 @@ ft_get_map(int fd, t_cub *clist)
return (-1);
}
mapl = (char*)ft_nrealloc(mapl, (((len / 2) + 2) * i) * sizeof(char),
- ((((len / 2) + 2) * i) + (ft_strlen(line) / 2) + 2) * sizeof(char));
+ ((((len / 2) + 2) * i) + (len / 2) + 2) * sizeof(char));
ft_linecpy(line, mapl, ((len / 2) + 2) * i);
ft_memdel(line);
i++;