Fix warning, check array exists before accessing