There shouldn't be a case where ->add_member() returns a null pointer. It should be safe to not make the null check.
On Tuesday, May 17, 2022 at 12:04:08 PM UTC-7 [email protected] wrote: > When we are constructing an object with repeated field member, we > generally call > auto memberObj = parentObject->add_member() -- C++ > > My question is that whether we should always add a defensive check for > NULL-Pointer being returned from the Add function. > I assume it will happen only in the out of memory condition. > > Protobuf does not throw an out of memory exception. > So is there a way to check if Add succeded or Failed. > > > Ashish > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/c53e2ff2-901d-4827-898b-30dee72fc1a3n%40googlegroups.com.
