Skip to content

Commit

Permalink
Fix #1535
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilJay committed Mar 2, 2016
1 parent a990ed7 commit 2600018
Showing 1 changed file with 6 additions and 5 deletions.
Expand Up @@ -105,8 +105,10 @@ protected Highlight getStackedHighlight(Highlight old, IBarDataSet set, int xInd
Range[] ranges = getRanges(entry);
int stackIndex = getClosestStackIndex(ranges, (float) yValue);

Highlight h = new Highlight(xIndex, dataSetIndex, stackIndex, ranges[stackIndex]);
return h;
if(ranges.length > 0)
return new Highlight(xIndex, dataSetIndex, stackIndex, ranges[stackIndex]);
else
return null;
}

/**
Expand Down Expand Up @@ -187,15 +189,14 @@ protected float getBase(float x) {
protected Range[] getRanges(BarEntry entry) {

float[] values = entry.getVals();
Range[] ranges = new Range[values.length];

This comment has been minimized.

Copy link
@danielgindi

danielgindi Mar 2, 2016

Collaborator

This could crash - as values could be null, as stated in the next if

This comment has been minimized.

Copy link
@PhilJay

PhilJay Mar 2, 2016

Author Owner

Damn... :-D


if (values == null || values.length == 0)
return null;
return ranges;

float negRemain = -entry.getNegativeSum();
float posRemain = 0f;

Range[] ranges = new Range[values.length];

for (int i = 0; i < ranges.length; i++) {

float value = values[i];
Expand Down

0 comments on commit 2600018

Please sign in to comment.