Skip to content

Commit 6d38ec3

Browse files
authored
fix(Alert): prevent error being thrown when using invalid variant (#8229)
1 parent a5a032b commit 6d38ec3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/react-core/src/components/Alert/AlertIcon.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ export interface AlertIconProps extends React.HTMLProps<HTMLDivElement> {
2626

2727
export const AlertIcon = ({ variant, customIcon, className = '', ...props }: AlertIconProps) => {
2828
const Icon = variantIcons[variant];
29-
return (
29+
return Icon ? (
3030
<div {...props} className={css(styles.alertIcon, className)}>
3131
{customIcon || <Icon />}
3232
</div>
33-
);
33+
) : null;
3434
};

0 commit comments

Comments
 (0)