Fix #2 random segfault after growing
see issue for more details https://github.com/Jonny999999/snake-pp/issues/2
This commit is contained in:
		
							parent
							
								
									ad1dd7f5c3
								
							
						
					
					
						commit
						cf92191177
					
				| @ -105,9 +105,10 @@ void runGameCycle() | ||||
|     //--- handle food ---
 | ||||
|     if (checkEaten()) { | ||||
|         LOGI("game: picked up food at x=%d y=%d -> growing, placing food\n", game.foodX, game.foodY); | ||||
|         // NOTE: order of place and grow is relevant, otherwise function in food.c will access invalid memory
 | ||||
|         placeFood();  | ||||
|         snakeGrow(); | ||||
|         placeFood(); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|     //--- update frame ---
 | ||||
|     //renderGame();
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user