Make sure errorMsg is defined (#76)

This commit is contained in:
gero3 2017-03-10 16:56:41 +01:00 committed by Ondrej Stava
parent db5e679828
commit e648e1bde5

View File

@ -76,7 +76,8 @@ THREE.DRACOLoader.prototype = {
console.log('Loaded a point cloud.'); console.log('Loaded a point cloud.');
} }
} else { } else {
console.error('THREE.DRACOLoader: Unknown geometry type.'); const errorMsg = 'THREE.DRACOLoader: Unknown geometry type.'
console.error(errorMsg);
throw new Error(errorMsg); throw new Error(errorMsg);
} }
return scope.convertDracoGeometryTo3JS(wrapper, geometryType, buffer, return scope.convertDracoGeometryTo3JS(wrapper, geometryType, buffer,
@ -124,7 +125,8 @@ THREE.DRACOLoader.prototype = {
const posAttId = wrapper.GetAttributeId(dracoGeometry, const posAttId = wrapper.GetAttributeId(dracoGeometry,
dracoDecoder.POSITION); dracoDecoder.POSITION);
if (posAttId == -1) { if (posAttId == -1) {
console.error('THREE.DRACOLoader: No position attribute found.'); const errorMsg = 'THREE.DRACOLoader: No position attribute found.';
console.error(errorMsg);
dracoDecoder.destroy(wrapper); dracoDecoder.destroy(wrapper);
dracoDecoder.destroy(dracoGeometry); dracoDecoder.destroy(dracoGeometry);
throw new Error(errorMsg); throw new Error(errorMsg);