diff --git a/src/google/protobuf/dynamic_message.cc b/src/google/protobuf/dynamic_message.cc index 7927107815..c4448d51a0 100644 --- a/src/google/protobuf/dynamic_message.cc +++ b/src/google/protobuf/dynamic_message.cc @@ -620,6 +620,7 @@ DynamicMessageFactory::~DynamicMessageFactory() { } const Message* DynamicMessageFactory::GetPrototype(const Descriptor* type) { + ABSL_CHECK(type != nullptr); absl::MutexLock lock(&prototypes_mutex_); return GetPrototypeNoLock(type); } diff --git a/src/google/protobuf/dynamic_message.h b/src/google/protobuf/dynamic_message.h index 8d53e28cbc..0af9d441b5 100644 --- a/src/google/protobuf/dynamic_message.h +++ b/src/google/protobuf/dynamic_message.h @@ -108,8 +108,8 @@ class PROTOBUF_EXPORT DynamicMessageFactory : public MessageFactory { // prototype, so these must be destroyed before the DynamicMessageFactory // is destroyed. // - // The given descriptor must outlive the returned message, and hence must - // outlive the DynamicMessageFactory. + // The given descriptor must be non-null and outlive the returned message, and + // hence must outlive the DynamicMessageFactory. // // The method is thread-safe. const Message* GetPrototype(const Descriptor* type) override;