Shader/FilesystemModuleResolver: Don't register in case of parsing errors
This commit is contained in:
parent
83deecd8f1
commit
7af25777dc
|
|
@ -26,9 +26,18 @@ namespace Nz
|
||||||
|
|
||||||
void FilesystemModuleResolver::RegisterModule(const std::filesystem::path& realPath)
|
void FilesystemModuleResolver::RegisterModule(const std::filesystem::path& realPath)
|
||||||
{
|
{
|
||||||
ShaderAst::ModulePtr module = ShaderLang::ParseFromFile(realPath);
|
ShaderAst::ModulePtr module;
|
||||||
if (!module)
|
try
|
||||||
|
{
|
||||||
|
module = ShaderLang::ParseFromFile(realPath);
|
||||||
|
if (!module)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch (const std::exception& e)
|
||||||
|
{
|
||||||
|
NazaraError("failed to register module from file " + realPath.generic_u8string() + ": " + e.what());
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::string moduleName = module->metadata->moduleName;
|
std::string moduleName = module->metadata->moduleName;
|
||||||
RegisterModule(std::move(module));
|
RegisterModule(std::move(module));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue