diff --git a/src/elements/a-gltf-entity.js b/src/elements/a-gltf-entity.js index c660dcbcf32c348c8b210c76329837413735e7b8..d8318246dd2aa91d28dbe084d0a3233c1d1d2684 100644 --- a/src/elements/a-gltf-entity.js +++ b/src/elements/a-gltf-entity.js @@ -227,7 +227,7 @@ AFRAME.registerElement("a-gltf-entity", { async value(src) { try { // If the src attribute is a selector, get the url from the asset item. - if (src.charAt(0) === "#") { + if (src && src.charAt(0) === "#") { const assetEl = document.getElementById(src.substring(1)); const fallbackSrc = assetEl.getAttribute("src"); @@ -246,6 +246,8 @@ AFRAME.registerElement("a-gltf-entity", { if (src === this.lastSrc) return; this.lastSrc = src; + if (!src) return; + const model = await cachedLoadGLTF(src); // If we started loading something else already