@ -18,6 +18,8 @@ int main(int argc, char **argv)
if (argc != 2)
return (printf("Usage: ./cub3d mapfile.cub\n"), EXIT_FAILURE);
if (ft_strncmp(argv[1] + ft_strlen(argv[1]) - 4, ".cub", 4))
return (printf("Wrong map file extension"), EXIT_FAILURE);
env = load_map(argv[1]);
if (!env)
return (EXIT_FAILURE);
@ -40,6 +40,8 @@ char *get_next_line(const int fd)
char *ret;
char *next;
if (fd == -1)
return (NULL);
if (!*buffer)
buffer[read(fd, buffer, BUFFER_SIZE)] = 0;
ret = ft_calloc(1, sizeof(char));