Skip to content

Commit

Permalink
Merge pull request #1908 from FormidableLabs/bug/barWidth-error-with-…
Browse files Browse the repository at this point in the history
…immutable-data

add a check for children before attempting barWidth calculation
  • Loading branch information
boygirl authored Jul 22, 2021
2 parents 6ad0807 + c6fb75d commit e9fbbd9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/victory-core/src/victory-util/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ export default {
}

const firstChild = Array.isArray(children) && children[0];
if (!firstChild) {
return undefined;
}
let barWidth = firstChild.props.barWidth;
let dataLength =
(firstChild.props.data && firstChild.props.data.length) || 1;
Expand Down

0 comments on commit e9fbbd9

Please sign in to comment.