Modified the function check_and_run_job to check for a NULL pa
after the call to get_jobs_array(). This prevents a segfault that
was reported in TRQ-1635.