mirror of https://github.com/xzeldon/htop.git
Avoid crash on huge screens.
Fix by @Explorer09 (see discussion on #355).
This commit is contained in:
parent
c148907e7b
commit
d311e85b91
7
Meter.c
7
Meter.c
|
@ -407,7 +407,12 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) {
|
||||||
data->values[nValues - 1] = value;
|
data->values[nValues - 1] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = nValues - (w*2) + 2, k = 0; i < nValues; i+=2, k++) {
|
int i = nValues - (w*2) + 2, k = 0;
|
||||||
|
if (i < 0) {
|
||||||
|
k = -i/2;
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
for (; i < nValues; i+=2, k++) {
|
||||||
int pix = GraphMeterMode_pixPerRow * GRAPH_HEIGHT;
|
int pix = GraphMeterMode_pixPerRow * GRAPH_HEIGHT;
|
||||||
int v1 = CLAMP(data->values[i] * pix, 1, pix);
|
int v1 = CLAMP(data->values[i] * pix, 1, pix);
|
||||||
int v2 = CLAMP(data->values[i+1] * pix, 1, pix);
|
int v2 = CLAMP(data->values[i+1] * pix, 1, pix);
|
||||||
|
|
Loading…
Reference in New Issue