title: MPAndroidChart Stacked BarChart Custom Markerview Nullpointer exception
body: <p>I am having a problem with the custom marker example I replicated exactly and set it on my Stacked Barchart but when I click on it I get an exception. </p>
  
  <p>The code is exactly the same as as <a href="https://github.com/PhilJay/MPAndroidChart/wiki/MarkerView" rel="nofollow">example</a>. </p>
  
  <p>The exception I get looks like this: </p>
  
  <pre><code>12-22 15:28:54.052 12901-12901/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                 Process: com.myapp.myapp, PID: 12901
                                                 java.lang.NullPointerException: Attempt to read from field 'float com.github.mikephil.charting.highlight.Range.to' on a null object reference
                                                     at com.github.mikephil.charting.charts.BarLineChartBase.getMarkerPosition(BarLineChartBase.java:571)
                                                     at com.github.mikephil.charting.charts.Chart.drawMarkers(Chart.java:598)
                                                     at com.github.mikephil.charting.charts.BarLineChartBase.onDraw(BarLineChartBase.java:252)
                                                     at android.view.View.draw(View.java:15114)
                                                     at android.view.View.updateDisplayListIfDirty(View.java:14048)
                                                     at android.view.View.getDisplayList(View.java:14071)
                                                     at android.view.View.draw(View.java:14838)
                                                     at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
                                                     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
                                                     at android.view.View.updateDisplayListIfDirty(View.java:14043)
                                                     at android.view.View.getDisplayList(View.java:14071)
                                                     at android.view.View.draw(View.java:14838)
                                                     at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
                                                     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
                                                     at android.view.View.draw(View.java:15117)
                                                     at android.support.v4.view.ViewPager.draw(ViewPager.java:2262)
                                                     at android.view.View.updateDisplayListIfDirty(View.java:14048)
                                                     at android.view.View.getDisplayList(View.java:14071)
                                                     at android.view.View.draw(View.java:14838)
                                                     at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
                                                     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
                                                     at android.view.View.updateDisplayListIfDirty(View.java:14043)
                                                     at android.view.View.getDisplayList(View.java:14071)
                                                     at android.view.View.draw(View.java:14838)
                                                     at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
                                                     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
                                                     at android.view.View.updateDisplayListIfDirty(View.java:14043)
                                                     at android.view.View.getDisplayList(View.java:14071)
                                                     at android.view.View.draw(View.java:14838)
                                                     at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
                                                     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
                                                     at android.view.View.updateDisplayListIfDirty(View.java:14043)
                                                     at android.view.View.getDisplayList(View.java:14071)
                                                     at android.view.View.draw(View.java:14838)
                                                     at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
                                                     at android.support.v4.widget.DrawerLayout.drawChild(DrawerLayout.java:1229)
                                                     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
                                                     at android.view.View.updateDisplayListIfDirty(View.java:14043)
                                                     at android.view.View.getDisplayList(View.java:14071)
                                                     at android.view.View.draw(View.java:14838)
                                                     at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
                                                     at android.support.design.widget.CoordinatorLayout.drawChild(CoordinatorLayout.java:1077)
                                                     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
                                                     at android.view.View.updateDisplayListIfDirty(View.java:14043)
                                                     at android.view.View.getDisplayList(View.java:14071)
                                                     at android.view.View.draw(View.java:14838)
                                                     at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
                                                     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
                                                     at android.view.View.updateDisplayListIfDirty(View.java:14043)
                                                     at android.view.View.getDisplayList(View.java:14071)
                                                     at android.view.View.draw(View.java:14838)
                                                     at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
                                                     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
                                                     at android.view.View.updateDisplayListIfDirty(View.java:14043)
                                                     at android.view.View.getDisplayList(View.java:14071)
                                                     at android.view.View.draw(View.java:14838)
                                                     at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
                                                     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
                                                     at android.view.View.updateDisplayListIfDirty(View.java:14043)
                                                     at android.view.View.getDisplayList(View.java:14071)
                                                     at android.view.View.draw(View.java:14838)
                                                     at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
                                                     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
                                                     at android.view.View.updateDisplayListIfDirty(View.java:14043)
                                                     at android.view.View.getDisplayList(View.java:14071)
                                                     at android.view.View.draw(View.java:14838)
                                                  at android.view.
  </code></pre>
  
  <p>Someone has any idea?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>So this is the <code>onValueSelected(..)</code>.</p>
  
  <pre><code>    @Override
      public void onValueSelected(Entry e, int dataSetIndex, Highlight h) {
          barChart.highlightValue(e.getXIndex(), dataSetIndex);
      }
  </code></pre>