Commit 4dc37c24 authored by antirez's avatar antirez
Browse files

LOLWUT: fix crash when col < 2.

Close #5345.
parent 690560e8
...@@ -177,7 +177,7 @@ void lwDrawSquare(lwCanvas *canvas, int x, int y, float size, float angle) { ...@@ -177,7 +177,7 @@ void lwDrawSquare(lwCanvas *canvas, int x, int y, float size, float angle) {
lwCanvas *lwDrawSchotter(int console_cols, int squares_per_row, int squares_per_col) { lwCanvas *lwDrawSchotter(int console_cols, int squares_per_row, int squares_per_col) {
/* Calculate the canvas size. */ /* Calculate the canvas size. */
int canvas_width = console_cols*2; int canvas_width = console_cols*2;
int padding = 2; int padding = console_cols > 2 ? 2 : 0;
float square_side = (float)(canvas_width-padding*2) / squares_per_row; float square_side = (float)(canvas_width-padding*2) / squares_per_row;
int canvas_height = square_side * squares_per_col + padding*2; int canvas_height = square_side * squares_per_col + padding*2;
lwCanvas *canvas = lwCreateCanvas(canvas_width, canvas_height); lwCanvas *canvas = lwCreateCanvas(canvas_width, canvas_height);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment