Skip to content

Commit b41817b

Browse files
authored
Merge pull request #25 from FezVrasta/fix/24
fix: don’t attempt to call prop.get() when prop is nullish
2 parents d132670 + d77f177 commit b41817b

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
@@ -511,7 +511,7 @@ export default class View extends Component {
511511
const representationIds = [];
512512
this.selections.forEach((v) => {
513513
const { prop } = v.getProperties();
514-
const { representationId } = prop.get('representationId');
514+
const representationId = prop?.get('representationId').representationId;
515515
if (representationId) {
516516
representationIds.push(representationId);
517517
}
@@ -529,6 +529,9 @@ export default class View extends Component {
529529
return this.selections.map((v) => {
530530
const { prop, compositeID, displayPosition } = v.getProperties();
531531

532+
// Return false to mark this item for removal
533+
if (prop == null) return false;
534+
532535
return {
533536
worldPosition: Array.from(
534537
this.openglRenderWindow.displayToWorld(
@@ -543,7 +546,7 @@ export default class View extends Component {
543546
...prop.get('representationId'),
544547
ray,
545548
};
546-
});
549+
}).filter(Boolean);
547550
}
548551
return [];
549552
}

0 commit comments

Comments
 (0)