Fix #8253: don't use INVALID_DATAPOINT for a valid value (#11913)

This commit is contained in:
Patric Stout 2024-02-01 22:47:11 +01:00 committed by GitHub
parent 9a2f247de9
commit 770ca3a624
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -615,7 +615,13 @@ public:
if (c != nullptr) {
this->colours[numd] = _colour_gradient[c->colour][6];
for (int j = this->num_on_x_axis, i = 0; --j >= 0;) {
this->cost[numd][i] = (j >= c->num_valid_stat_ent) ? INVALID_DATAPOINT : GetGraphData(c, j);
if (j >= c->num_valid_stat_ent) {
this->cost[numd][i] = INVALID_DATAPOINT;
} else {
/* Ensure we never assign INVALID_DATAPOINT, as that has another meaning.
* Instead, use the value just under it. Hopefully nobody will notice. */
this->cost[numd][i] = std::min(GetGraphData(c, j), INVALID_DATAPOINT - 1);
}
i++;
}
}