1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-26 12:27:52 +00:00

Make sure gradient width is >=2.

This should resolve #1070 for real this time.
This commit is contained in:
Brenden Matthews 2021-03-09 07:54:37 -06:00
parent 16f2ed659e
commit 33aa5060c2
No known key found for this signature in database
GPG Key ID: B49ABB7270D9D4FD
2 changed files with 7 additions and 0 deletions

View File

@ -92,6 +92,10 @@ std::unique_ptr<unsigned long[]> do_gradient(int width,
int reddiff, greendiff, bluediff; // difference
short redshift = (2 * colour_depth / 3 + colour_depth % 3);
short greenshift = (colour_depth / 3);
// Make sure the width is always at least 2
width = std::max(2, width);
std::unique_ptr<unsigned long[]> colours(new unsigned long[width]);
if (colour_depth == 0) { set_up_gradient(); }

View File

@ -153,6 +153,9 @@ std::unique_ptr<unsigned long[]> do_hsv_gradient(int width,
int redshift = (2 * colour_depth / 3 + colour_depth % 3);
int greenshift = (colour_depth / 3);
// Make sure the width is always at least 2
width = std::max(2, width);
std::unique_ptr<unsigned long[]> colours(new unsigned long[width]);
if (colour_depth == 0) { set_up_gradient(); }