From 4307992cbc883779a1367c9a1e681f499ed6cde1 Mon Sep 17 00:00:00 2001 From: Sheldon Lee Date: Sun, 5 Jul 2020 13:45:57 +0100 Subject: [PATCH] Added line to prevent zero division. --- grid.c | 1 + 1 file changed, 1 insertion(+) diff --git a/grid.c b/grid.c index 99034c3..df03f89 100644 --- a/grid.c +++ b/grid.c @@ -51,6 +51,7 @@ bool getPixel(Grid* grid, int x, int y) void getDimensions(Grid* grid, unsigned int* width, unsigned int* height) { + if (grid->size == 0) return; *width = grid->width; *height = grid->size/grid->width; }