Check if batch is null before execution