diff --git a/src/libmittos/graphics/graphics.c b/src/libmittos/graphics/graphics.c index 128589e..0b2859b 100644 --- a/src/libmittos/graphics/graphics.c +++ b/src/libmittos/graphics/graphics.c @@ -35,7 +35,9 @@ void draw_line( int64_t diff = dx - dy; uint32_t *fb = (uint32_t *)ctx->buffer; while(1) { - fb[PXL(ctx, x, y)] = clr; + if(0 < x && x < ctx->width && + 0 < y && y < ctx->height) + fb[PXL(ctx, x, y)] = clr; if(x == x1 && y == y1) break; if((2*diff) > -dy) {