Fixed crash

Fixed a null pointer being passed to the bearing calc code