Avoid an error after a one-time scheduled job

When setting a scheduled job that occurs just one time, the function
was returning an error because next[1] is then undefined and .getTime()
is not defined. Adding a test to bypass this error.