Field3d: don't crash under opening failures #1848
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Field3D is supposed to just throw an exception that we can catch if it
can't open the file, but under some circumstances it just plain crashes
when asked to open a file that isn't a f3d file at all.
The reason this comes up is that OIIO's behaveior when the usual reader
can't open a file is to try ALL of them (hoping that maybe the file is
just mis-named) or the hint heuristics are wrong.
I'm not inclined to try to fix the field3d internals myself at this
moment, so for now I'm just making the OIIO field3d reader fail if the
file is not named ".f3d". This violates our intended rule of "it doesn't
matter what the file is called", but I can only rely on that if the
underlying format library is rock solid when presented a file of the
wrong type.