Protobuf support.

Since protobuf uses empty contructor, guard against nulls.