Skip to content

Commit

Permalink
EntityModelManager::renderer: catch exceptions thrown by model() (#1531)
Browse files Browse the repository at this point in the history
Fixes #1525
  • Loading branch information
ericwa authored and kduske committed Dec 7, 2016
1 parent 72bbf85 commit 399226c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion common/src/Assets/EntityModelManager.cpp
Expand Up @@ -93,8 +93,17 @@ namespace TrenchBroom {
}
}

EntityModel* EntityModelManager::safeGetModel(const IO::Path& path) const {
try {
return model(path);
} catch (const GameException&) {
return NULL;
}
}

Renderer::TexturedIndexRangeRenderer* EntityModelManager::renderer(const Assets::ModelSpecification& spec) const {
EntityModel* entityModel = model(spec.path);
EntityModel* entityModel = safeGetModel(spec.path);

if (entityModel == NULL)
return NULL;

Expand Down
1 change: 1 addition & 0 deletions common/src/Assets/EntityModelManager.h
Expand Up @@ -77,6 +77,7 @@ namespace TrenchBroom {
void setLoader(const IO::EntityModelLoader* loader);

EntityModel* model(const IO::Path& path) const;
EntityModel* safeGetModel(const IO::Path& path) const;
Renderer::TexturedIndexRangeRenderer* renderer(const Assets::ModelSpecification& spec) const;

bool hasModel(const Model::Entity* entity) const;
Expand Down

0 comments on commit 399226c

Please sign in to comment.