core: fix off-by-one causing incorrect profile display
In commit 4724c88 get_plot_details_new was updated to pass an index instead of the entry into plot_string. This means we are passing "i" to plot_string after the final increment of the for loop, instead of getting the entry[i] within the loop before the final increment. This means if we are mousing over the far right of the graph, where the time based break is not hit, we will end up passing an index equal to nr-2 instead of nr-3, which is intended to shave off the final two rows containing data not useful to the display. There are a handful of ways to fix this. This commit intends to be consistent with stylistic choices made elsewhere in the project. Signed-off-by: Josh Torres <torres.josh.j@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
64faa23448
commit
7e6d9935f1
@ -1571,7 +1571,7 @@ int get_plot_details_new(const struct dive *d, const struct plot_info *pi, int t
|
||||
/* The two first and the two last plot entries do not have useful data */
|
||||
if (pi->nr <= 4)
|
||||
return 0;
|
||||
for (i = 2; i < pi->nr - 2; i++) {
|
||||
for (i = 2; i < pi->nr - 3; i++) {
|
||||
if (pi->entry[i].sec >= time)
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user