From 27f82938af8a322c6704183a960d6daabdfd894b Mon Sep 17 00:00:00 2001 From: Brian Peiris <brianpeiris@gmail.com> Date: Thu, 29 Mar 2018 18:06:32 -0700 Subject: [PATCH] add warning when src asset doesn't exist --- src/elements/a-gltf-entity.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/elements/a-gltf-entity.js b/src/elements/a-gltf-entity.js index 66dbc69dc..33489e2bc 100644 --- a/src/elements/a-gltf-entity.js +++ b/src/elements/a-gltf-entity.js @@ -238,7 +238,10 @@ AFRAME.registerElement("a-gltf-entity", { // If the src attribute is a selector, get the url from the asset item. if (src && src.charAt(0) === "#") { const assetEl = document.getElementById(src.substring(1)); - if (!assetEl) { return; } + if (!assetEl) { + console.warn(`Attempted to use non-existent asset ${src} as src for`, this); + return; + } const fallbackSrc = assetEl.getAttribute("src"); const highSrc = assetEl.getAttribute("high-src"); -- GitLab