cereal: (guest) Add null pointer guards for counter variables. This is the guest-side change of aosp/1583345, which adds pointer guards if-statements to all counter variable pointers used in for loop. Change-Id: Id2fb70368a855b8065488cbe5738672c24772562