Fix possible division by zero in radius calculation.

Check all possible causes of division by zero in the
calculation of the radius.
This commit is contained in:
Maxime Wack 2020-08-10 22:42:46 +02:00
parent 37feb7d6a3
commit 6f5f003e2b

View File

@ -412,7 +412,7 @@ static int layout_get_height(struct colored_layout *cl)
*/ */
static int frame_internal_radius (int r, int w, int h) static int frame_internal_radius (int r, int w, int h)
{ {
if (r == 0 || w == 0 || h == 0) if (r == 0 || h + (w - r) * 2 == 0)
return 0; return 0;
// Integer precision scaler, using 1/4 of int size // Integer precision scaler, using 1/4 of int size