Add missing NULL check in cmd_lastlog