Skip to content

Commit d77f177

Browse files
committed
fix(View): Prevent invalid access when picking
1 parent 1506c70 commit d77f177

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/core/View.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ export default class View extends Component {
493493
const representationIds = [];
494494
this.selections.forEach((v) => {
495495
const { prop } = v.getProperties();
496-
const { representationId } = prop.get('representationId');
496+
const representationId = prop?.get('representationId').representationId;
497497
if (representationId) {
498498
representationIds.push(representationId);
499499
}
@@ -511,6 +511,9 @@ export default class View extends Component {
511511
return this.selections.map((v) => {
512512
const { prop, compositeID, displayPosition } = v.getProperties();
513513

514+
// Return false to mark this item for removal
515+
if (prop == null) return false;
516+
514517
return {
515518
worldPosition: Array.from(
516519
this.openglRenderWindow.displayToWorld(
@@ -525,7 +528,7 @@ export default class View extends Component {
525528
...prop.get('representationId'),
526529
ray,
527530
};
528-
});
531+
}).filter(Boolean);
529532
}
530533
return [];
531534
}

0 commit comments

Comments
 (0)