Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Commit

Permalink
fix(Flag): Check if flag exists before rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
bstream committed May 29, 2017
1 parent 76eba45 commit 96b7776
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/flag/flag.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ function Flag({ className, style, countryCode, secondaryCountryCode, size, round
};

const SvgFlag = flags[countryCode.toLowerCase()];

if (!SvgFlag) {
return null;
}

const flag = <SvgFlag className="flag" style={flagStyle} {...rest} />;

if (round) {
Expand All @@ -46,6 +51,7 @@ function Flag({ className, style, countryCode, secondaryCountryCode, size, round
}

Flag.defaultProps = {
countryCode: '',
size: 32,
round: false,
};
Expand Down

0 comments on commit 96b7776

Please sign in to comment.