Skip to content

Commit 551ef30

Browse files
authored
fix(ui5-tree): add event validation to selection handler (#11364)
Problem: The issue occurs because the selection-change event from the MultiComboBox bubbles up to the Tree component, which tries to process it as a Tree selection event but the event doesn't have the expected properties. Solution: Added validation checks in the _onListSelectionChange method to verify that the expected properties exist before attempting to access them. Fixes: #11352
1 parent 89d9924 commit 551ef30

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/main/src/Tree.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,10 @@ class Tree extends UI5Element {
440440
}
441441

442442
_onListSelectionChange(e: CustomEvent<ListSelectionChangeEventDetail>) {
443+
if (!e.detail || !e.detail.previouslySelectedItems || !e.detail.selectedItems) {
444+
return;
445+
}
446+
443447
const previouslySelectedItems = e.detail.previouslySelectedItems as Array<TreeItemBase>;
444448
const selectedItems = e.detail.selectedItems as Array<TreeItemBase>;
445449
const targetItem = e.detail.targetItem as TreeItemBase;

0 commit comments

Comments
 (0)