diff options
Diffstat (limited to 'php/src/Google')
-rw-r--r-- | php/src/Google/Protobuf/Internal/DescriptorPool.php | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/php/src/Google/Protobuf/Internal/DescriptorPool.php b/php/src/Google/Protobuf/Internal/DescriptorPool.php index 65d1a884..304c1615 100644 --- a/php/src/Google/Protobuf/Internal/DescriptorPool.php +++ b/php/src/Google/Protobuf/Internal/DescriptorPool.php @@ -109,18 +109,30 @@ class DescriptorPool public function getDescriptorByClassName($klass) { - return $this->class_to_desc[$klass]; + if (isset($this->class_to_desc[$klass])) { + return $this->class_to_desc[$klass]; + } else { + return null; + } } public function getEnumDescriptorByClassName($klass) { - return $this->class_to_enum_desc[$klass]; + if (isset($this->class_to_enum_desc[$klass])) { + return $this->class_to_enum_desc[$klass]; + } else { + return null; + } } public function getDescriptorByProtoName($proto) { - $klass = $this->proto_to_class[$proto]; - return $this->class_to_desc[$klass]; + if (isset($this->proto_to_class[$proto])) { + $klass = $this->proto_to_class[$proto]; + return $this->class_to_desc[$klass]; + } else { + return null; + } } public function getEnumDescriptorByProtoName($proto) |