diff --git a/du7/snake.c b/du7/snake.c index 0e263fb..9fbdebf 100644 --- a/du7/snake.c +++ b/du7/snake.c @@ -2,12 +2,13 @@ #include struct snake* add_snake(struct snake* snake,int x,int y){ - if (snake == NULL) return NULL; - struct snake* novyZaciatok; novyZaciatok->x = x; novyZaciatok->y = y; - snake->next = novyZaciatok; + + if (snake != NULL) { + snake->next = novyZaciatok; + } return novyZaciatok; }