Skip to content

Commit

Permalink
Merge pull request #579 from KhronosGroup/fix/catch_invalid_gltf
Browse files Browse the repository at this point in the history
Catch error during gltf loading and clear with empty gltf [574]
  • Loading branch information
UX3D-haertl authored Oct 1, 2024
2 parents c80a591 + eca58ff commit 39aa5bd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion glTF-Sample-Renderer
13 changes: 13 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,19 @@ export default async () => {
uiModel.exitLoadingState();

return state;
}).catch((error) => {
console.error("Loading failed: "+ error);
resourceLoader
.loadGltf(undefined, undefined)
.then((gltf) => {
state.gltf = gltf;
state.sceneIndex = 0;
state.cameraIndex = undefined;

uiModel.exitLoadingState();
redraw = true;
});
return state;
})
);
}),
Expand Down

0 comments on commit 39aa5bd

Please sign in to comment.