Skip to content

Commit

Permalink
Merge pull request #4006 from UberNick/master
Browse files Browse the repository at this point in the history
Added a safety check before an unsafe array operation
  • Loading branch information
liuxuan30 authored Jun 10, 2019
2 parents 899fe1d + e6b01f7 commit e850593
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Source/Charts/Renderers/PieChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,9 @@ open class PieChartRenderer: DataRenderer

// Prepend selected slices before the already rendered unselected ones.
// NOTE: - This relies on drawDataSet() being called before drawHighlighted in PieChartView.
accessibleChartElements.insert(contentsOf: highlightedAccessibleElements, at: 1)
if !accessibleChartElements.isEmpty {
accessibleChartElements.insert(contentsOf: highlightedAccessibleElements, at: 1)
}

context.restoreGState()
}
Expand Down

0 comments on commit e850593

Please sign in to comment.