From 943183161291b3232552d8352eceef7483517ed9 Mon Sep 17 00:00:00 2001 From: Bernard Kwok Date: Wed, 10 Feb 2021 07:33:52 -0500 Subject: [PATCH] Fix adding search path to empty filenames during when "flattening" (#1107) * Don't append a search path if the filename to consider is empty. * Review update. --- source/MaterialXFormat/Util.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/MaterialXFormat/Util.cpp b/source/MaterialXFormat/Util.cpp index 3f360b1e95..38f7943157 100644 --- a/source/MaterialXFormat/Util.cpp +++ b/source/MaterialXFormat/Util.cpp @@ -148,6 +148,10 @@ void flattenFilenames(DocumentPtr doc, const FileSearchPath& searchPath, StringR } FilePath unresolvedValue(valueElem->getValueString()); + if (unresolvedValue.isEmpty()) + { + continue; + } StringResolverPtr elementResolver = elem->createStringResolver(); // If the path is already absolute then don't allow an additional prefix // as this would make the path invalid. @@ -157,7 +161,7 @@ void flattenFilenames(DocumentPtr doc, const FileSearchPath& searchPath, StringR } string resolvedString = valueElem->getResolvedValueString(elementResolver); - // Convert relative to absolute pathing if the file is not alrady found + // Convert relative to absolute pathing if the file is not already found if (!searchPath.isEmpty()) { FilePath resolvedValue(resolvedString);