Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
types/known/anypb: gracefully handle nil sources
Add checks so that MarshalFrom and UnmarshalTo consistently matches the behavior of the proto package with regard to nil messages. In particular, using a nil message as the destination results in a panic (which is already the current behavior), while using a nil message as the source does not panic (it is usually treated as an untyped empty message). Since an untyped message has no sensible meaning in the context of Any, return an error. Change-Id: I99e86c2cdfbd8be57cc039efd550458dc56aadbc Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/237920 Reviewed-by: Damien Neil <dneil@google.com>
- Loading branch information