No, protobuf accessors never return null. For message fields, you get the
default instance of the message type.

On Fri, Jun 4, 2010 at 9:32 AM, Jax <jax...@gmail.com> wrote:

>
> This should be pretty straightforward, but I couldn't find it in any
> of the documentation on default values.
>
> A slight change from some example code in the google documentation:
>
> message SearchResponse {
>  optional Result result = 1;
> }
>
> message Result {
>  required string url = 1;
>  optional string title = 2;
>  repeated string snippets = 3;
> }
>
> My question is, what is the default value for the Result in the above
> code? Does it get set to null since (I presume) it will be compiled
> into an object when the protocol buffer gets compiled into Java or C#?
> Or do default values work differently for a nested message than for
> base types?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to proto...@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to