fix(dashboard-v2): prevent division by zero

This commit is contained in:
Michał Leszczyk 2022-02-28 16:36:51 +01:00
parent e9c3cfce42
commit 2653de6bb9
No known key found for this signature in database
GPG Key ID: FA123CA8BAA2FBF4
1 changed files with 1 additions and 1 deletions

View File

@ -20,7 +20,7 @@ const BarLabel = styled.span.attrs({
`; `;
export const GraphBar = ({ value, limit, label }) => { export const GraphBar = ({ value, limit, label }) => {
const percentage = (value / limit) * 100; const percentage = typeof limit !== "number" || limit === 0 ? 0 : (value / limit) * 100;
return ( return (
<div className="relative flex items-center"> <div className="relative flex items-center">