Buggy code:
@ SuppressLint ( "NewApi" ) public abstract class Chart < T extends ChartData < ? extends DataSet < ? extends Entry > > > extends ViewGroup implements ChartInterface { public static final String LOG_TAG = "MPAndroidChart" ; protected boolean mLogEnabled = false ; protected T mData = null ; protected ValueFormatter mDefaultFormatter ; protected Paint mDescPaint ; protected Paint mInfoPaint ; protected String mDescription = "Description" ; protected boolean mDataNotSet = true ; protected boolean mDrawUnitInChart = false ; protected float mDeltaX = 1.0F ; protected float mXChartMin = 0.0F ; protected float mXChartMax = 0.0F ; protected boolean mTouchEnabled = true ; protected boolean mHighlightEnabled = true ; protected Legend mLegend ; protected OnChartValueSelectedListener mSelectionListener ; private String mNoDataText = "No<seq2seq4repair_space>chart<seq2seq4repair_space>data<seq2seq4repair_space>available." ; private OnChartGestureListener mGestureListener ; private String mNoDataTextDescription ; protected LegendRenderer mLegendRenderer ; protected DataRenderer mRenderer ; protected ViewPortHandler mViewPortHandler ; protected ChartAnimator mAnimator ; public Chart ( Context context ) { } public Chart ( Context context , AttributeSet attrs ) { } public Chart ( Context context , AttributeSet attrs , int defStyle ) { } protected void init ( ) { } public void setData ( T data ) { <START_BUG> if ( data == null ) { <END_BUG> Log . e ( Chart . LOG_TAG , "Cannot<seq2seq4repair_space>set<seq2seq4repair_space>data<seq2seq4repair_space>for<seq2seq4repair_space>chart.<seq2seq4repair_space>Provided<seq2seq4repair_space>data<seq2seq4repair_space>object<seq2seq4repair_space>is<seq2seq4repair_space>null." ) ; return ; } mDataNotSet = false ; mOffsetsCalculated = false ; mData = data ; calculateFormatter ( data . getYMin ( ) , data . getYMax ( ) ) ; for ( DataSet < ? > set : mData . getDataSets ( ) ) { if ( set . needsDefaultFormatter ( ) ) set . setValueFormatter ( mDefaultFormatter ) ; } notifyDataSetChanged ( ) ; if ( mLogEnabled ) Log . i ( Chart . LOG_TAG , "Data<seq2seq4repair_space>is<seq2seq4repair_space>set." ) ; } public void clear ( ) { } public void clearValues ( ) { } public boolean isEmpty ( ) { } public abstract void notifyDataSetChanged ( ) { } protected abstract void calculateOffsets ( ) { } protected abstract void calcMinMax ( ) { } protected void calculateFormatter ( float min , float max ) { } private boolean mOffsetsCalculated = false ; protected Bitmap mDrawBitmap ; protected Paint mDrawPaint ; @ Override protected void onDraw ( Canvas canvas ) { } protected void drawDescription ( Canvas c ) { } protected Highlight [ ] mIndicesToHightlight = new Highlight [ 0 ] ; public Highlight [ ] getHighlighted ( ) { } public boolean valuesToHighlight ( ) { } public void highlightValues ( Highlight [ ] highs ) { } public void highlightValue ( int xIndex , int dataSetIndex ) { } public void highlightTouch ( Highlight high ) { } protected boolean mDrawMarkerViews = true ; protected MarkerView mMarkerView ; protected void drawMarkers ( Canvas canvas ) { } protected abstract float [ ] getMarkerPosition ( Entry e , int dataSetIndex ) { } public ChartAnimator getAnimator ( ) { } public void animateXY ( int durationMillisX , int durationMillisY ) { } public void animateX ( int durationMillis ) { } public void animateY ( int durationMillis ) { } public ValueFormatter getDefaultValueFormatter ( ) { } public void setOnChartValueSelectedListener ( OnChartValueSelectedListener l ) { } public void setOnChartGestureListener ( OnChartGestureListener l ) { } public OnChartGestureListener getOnChartGestureListener ( ) { } public void setHighlightEnabled ( boolean enabled ) { } public boolean isHighlightEnabled ( ) { } public float getYValueSum ( ) { } public float getYMax ( ) { } public float getYMin ( ) { } @ Override public float getXChartMax ( ) { } @ Override public float getXChartMin ( ) { } public float getAverage ( ) { } public float getAverage ( String dataSetLabel ) { } public int getValueCount ( ) { } public PointF getCenter ( ) { } @ Override public PointF getCenterOffsets ( ) { } public void setDescriptionTextSize ( float size ) { } public void setLogEnabled ( boolean enabled ) { } public boolean isLogEnabled ( ) { } public void setDescription ( String desc ) { } public void setNoDataText ( String text ) { } public void setNoDataTextDescription ( String text ) { } public void setTouchEnabled ( boolean enabled ) { } public void setMarkerView ( MarkerView v ) { } public MarkerView getMarkerView ( ) { } public Legend getLegend ( ) { } public LegendRenderer getLegendRenderer ( ) { } @ Override public RectF getContentRect ( ) { } public void disableScroll ( ) { } public void enableScroll ( ) { } public static final int PAINT_GRID_BACKGROUND = 4 ; public static final int PAINT_INFO = 7 ; public static final int PAINT_DESCRIPTION = 11 ; public static final int PAINT_HOLE = 13 ; public static final int PAINT_CENTER_TEXT = 14 ; public static final int PAINT_LEGEND_LABEL = 18 ; public void setPaint ( Paint p , int which ) { } public Paint getPaint ( int which ) { } public boolean isDrawMarkerViewEnabled ( ) { } public void setDrawMarkerViews ( boolean enabled ) { } public String getXValue ( int index ) { } public List < Entry > getEntriesAtIndex ( int xIndex ) { } public T getData ( ) { } public float getPercentOfTotal ( float val ) { } public void setDescriptionTypeface ( Typeface t ) { } public ViewPortHandler getViewPortHandler ( ) { } public DataRenderer getRenderer ( ) { } public void setRenderer ( DataRenderer renderer ) { } public Bitmap getChartBitmap ( ) { } public boolean saveToPath ( String title , String pathOnSD ) { } public boolean saveToGallery ( String fileName , int quality ) { } @ Override protected void onMeasure ( int widthMeasureSpec , int heightMeasureSpec ) { } @ Override protected void onLayout ( boolean changed , int left , int top , int right , int bottom ) { } @ Override protected void onSizeChanged ( int w , int h , int oldw , int oldh ) { }

Fix:
if ( ( data == null ) || ( ( data . getYValCount ( ) ) <= 0 ) ) {