Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
4dc37c24
Commit
4dc37c24
authored
Sep 13, 2018
by
antirez
Browse files
LOLWUT: fix crash when col < 2.
Close #5345.
parent
690560e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lolwut.c
View file @
4dc37c24
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment