Skip to content

Commit

Permalink
add some failsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenLYZ committed Jun 9, 2022
1 parent 484e237 commit 806ac54
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,13 @@ export default class Chart extends React.Component {
}

getHeaderHeight() {
const marginBottom = parseInt(
getComputedStyle(this.headerRef).getPropertyValue('margin-bottom'),
);
return this.headerRef
? this.headerRef.offsetHeight +
parseInt(
getComputedStyle(this.headerRef).getPropertyValue('margin-bottom'),
10,
)
? this.headerRef.offsetHeight + Number.isNaN(marginBottom)
? 0
: marginBottom
: DEFAULT_HEADER_HEIGHT;
}

Expand Down

0 comments on commit 806ac54

Please sign in to comment.