Clarify that the input to proto2::DynamicMessageFactory::GetPrototype should be non-null

PiperOrigin-RevId: 631938646
pull/16778/head
Protobuf Team Bot 7 months ago committed by Copybara-Service
parent ec126a5069
commit b694cfa441
  1. 1
      src/google/protobuf/dynamic_message.cc
  2. 4
      src/google/protobuf/dynamic_message.h

@ -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);
}

@ -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;

Loading…
Cancel
Save