Skip to content

Commit c948a85

Browse files
authored
Fixed a runtime error caused by the Pills Container component trying to access an undefined icon. (#3152)
* The Pills Container component tries to access a property of undefined * The Pills Container component tries to access a property of undefined * pills * pills * pills * package-lock-removal * Pills
1 parent c8a7d05 commit c948a85

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

components/pill-container/private/selected-listbox.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ const getAvatar = (option) => {
140140
};
141141

142142
const getIcon = (option) => {
143-
const iconObject = option.icon;
143+
const iconObject = option?.icon || null;
144144
let icon = null;
145145

146146
if (iconObject) {

components/pill/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class Pill extends React.Component {
198198
};
199199

200200
renderIcon = () => {
201-
const icon = this.props.icon || this.props.avatar;
201+
const icon = this.props?.icon || this.props?.avatar;
202202
if (icon) {
203203
return <span className="slds-pill__icon_container">{icon}</span>;
204204
}

0 commit comments

Comments
 (0)