Skip to content

Commit

Permalink
Avoid crash when dataset is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgindi committed Oct 10, 2016
1 parent e106289 commit 555176b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ public void set(BarLineScatterCandleBubbleDataProvider chart, IBarLineScatterCan
Entry entryFrom = dataSet.getEntryForXValue(low, Float.NaN, DataSet.Rounding.DOWN);
Entry entryTo = dataSet.getEntryForXValue(high, Float.NaN, DataSet.Rounding.UP);

min = dataSet.getEntryIndex(entryFrom);
max = dataSet.getEntryIndex(entryTo);
min = entryFrom == null ? 0 : dataSet.getEntryIndex(entryFrom);
max = entryTo == null ? 0 : dataSet.getEntryIndex(entryTo);
range = (int) ((max - min) * phaseX);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public float[] generateTransformedValuesBubble(IBubbleDataSet data, float phaseY
public float[] generateTransformedValuesLine(ILineDataSet data,
float phaseX, float phaseY, int from, int to) {

final int count = (int) ((to - from) * phaseX + 1) * 2;
final int count = (int) ((to - from) * phaseX) * 2;

if (valuePointsForGenerateTransformedValuesLine.length != count) {
valuePointsForGenerateTransformedValuesLine = new float[count];
Expand Down

0 comments on commit 555176b

Please sign in to comment.