Skip to content

Commit a7673d5

Browse files
awendelin-workMatthewKhouzam
authored andcommitted
tmf: Fix HistogramDataProvider index OOB
For the event statistics histogram view, the HistogramDataProvider will occasionally fail with an IndexOutOfBoundsException when its fetchXY method is called before its state-system backed statistics have been populated with attributes. Add a check to verify that the y-values provided by the statistics is is large enough for the x-values. Signed-off-by: Adam Wendelin <[email protected]>
1 parent a6eb70c commit a7673d5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/histogram/HistogramDataProvider.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ public TmfModelResponse<TmfTreeModel<TmfTreeDataModel>> fetchTree(Map<String, Ob
126126
final ITmfStatistics stats = Objects.requireNonNull(fModule.getStatistics());
127127
if (selected.contains(fTotalId)) {
128128
List<Long> values = stats.histogramQuery(filter.getTimesRequested());
129+
if (values.size() < n) {
130+
return TmfXyResponseFactory.create(TITLE, xValues, Collections.emptyList(), false);
131+
}
129132

130133
double[] y = new double[n];
131134
Arrays.setAll(y, values::get);

0 commit comments

Comments
 (0)