Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OpenImageIOAlgo : Properly handle empty metadata values
`ustring->c_str()` returns a `NULL` pointer for empty strings. https://github.com/AcademySoftwareFoundation/OpenImageIO/blob/master/src/include/OpenImageIO/ustring.h#L139-L143 https://github.com/AcademySoftwareFoundation/OpenImageIO/blob/master/src/include/OpenImageIO/ustring.h#L290 This error was noticed when other OIIO changes started returning new metadata keys for which the values were empty strings, and thus causing segfaults when the `NULL` pointer wasn't handled properly. The solution here is to use `string()` instead of `c_str()`, which returns an empty string in those cases, and is expected to be equally performant since the std strings are already stored in the internal `ustring` table: https://github.com/AcademySoftwareFoundation/OpenImageIO/blob/master/src/include/OpenImageIO/ustring.h#L760
- Loading branch information