Avoid crash on huge screens.

Fix by @Explorer09 (see discussion on #355).
This commit is contained in:
Hisham 2016-02-02 23:20:11 +00:00
parent c148907e7b
commit d311e85b91
1 changed files with 6 additions and 1 deletions

View File

@ -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);