提交 a6cb0b65 编写于 作者: M Mr.doob

ObjectLoader: Added try/catch. See #9909.

上级 7d6c3283
......@@ -56,7 +56,19 @@ Object.assign( ObjectLoader.prototype, {
var loader = new XHRLoader( scope.manager );
loader.load( url, function ( text ) {
var json = JSON.parse( text );
var json = null;
try {
json = JSON.parse( text );
} catch ( error ) {
console.error( 'THREE:ObjectLoader: Can\'t parse ' + url + '.', error.message );
return;
}
var metadata = json.metadata;
if ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册