Prevent division by zero

The original code would first compute `1/focalLength` and then check that `focalLength` is positive. So if `focalLength` was zero the code would crash.

This was found with Cppcheck