Skip to content

Commit

Permalink
fix(ui5-avatar-group): prevent console error when no items are present
Browse files Browse the repository at this point in the history
Added a null-check in the `firstAvatarSize` getter to prevent a
TypeError when the component is initialized without items. This ensures
that the component behaves correctly and does not throw errors in the
console when it is first loaded or when no items are present.

Fixes #9581
  • Loading branch information
kgogov committed Jul 30, 2024
1 parent f887689 commit c17215b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/main/src/AvatarGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ class AvatarGroup extends UI5Element {
}

get firstAvatarSize() {
return this.items[0].size;
return this.items[0]?.size ?? AvatarSize.S;
}

get classes() {
Expand Down

0 comments on commit c17215b

Please sign in to comment.