Skip to content

Commit

Permalink
Fix adding search path to empty filenames during when "flattening" (#…
Browse files Browse the repository at this point in the history
…1107)

* Don't append a search path if the filename to consider is empty.

* Review update.
  • Loading branch information
bernardkwok authored Feb 10, 2021
1 parent 2de7f69 commit 9431831
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion source/MaterialXFormat/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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);
Expand Down

0 comments on commit 9431831

Please sign in to comment.