Added a check for a null pointer to an array for a job in
check_and_run_job. Also moved a call to unlock_ai_mutex to
only unlock if the array pointer is not null. TRQ-1863