Skip to content

Commit

Permalink
Added outofbounds check in getEntryForHighlight (PhilJay#898)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilJay committed Jul 27, 2015
1 parent af9ac44 commit 39b4e0f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ public class BarEntry extends Entry {
private float mPositiveSum;

/**
* Constructor for stacked bar entries. Don't forget to order the stacked-values in an ascending order e.g.
* (-2,-1,0,1,2).
* Constructor for stacked bar entries.
*
* @param vals
* - the stack values, use at lest 2
Expand All @@ -42,8 +41,7 @@ public BarEntry(float val, int xIndex) {
}

/**
* Constructor for stacked bar entries. Don't forget to order the stacked-values in an ascending order e.g.
* (-2,-1,0,1,2).
* Constructor for stacked bar entries.
*
* @param vals
* - the stack values, use at least 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,10 @@ protected String[] getDataSetLabels() {
* @return the entry that is highlighted
*/
public Entry getEntryForHighlight(Highlight highlight) {
return mDataSets.get(highlight.getDataSetIndex()).getEntryForXIndex(
if(highlight.getDataSetIndex() >= mDataSets.size())
return null;
else
return mDataSets.get(highlight.getDataSetIndex()).getEntryForXIndex(
highlight.getXIndex());
}

Expand Down

0 comments on commit 39b4e0f

Please sign in to comment.