Add null check after allocating op_flags