Avoid segfault.
Catch any exceptions when generating tangents.