Browse Source

error if map extension isn't valid

master
nicolas-arnaud 2 years ago
parent
commit
c2260bad4a
  1. 2
      src/main.c
  2. 2
      src/parsing/getline.c

2
src/main.c

@ -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);

2
src/parsing/getline.c

@ -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));

Loading…
Cancel
Save