Fix NullPointerException in scheduled task (had no adverse effects other than spamming the log).