Skip to content

Commit

Permalink
handle null pointer exception
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAshe committed Mar 7, 2021
1 parent 451311f commit e1fc837
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/FedEx/AbstractComplexType.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ abstract class AbstractComplexType
/**
* Constructor
*
* @param array $options Data as key => value array
* @param array|null $options Data as key => value array
*/
public function __construct(array $options = null)
{
Expand Down Expand Up @@ -75,11 +75,13 @@ public function &__get($name)
if ($reflectionClass->hasMethod($setterMethodName)) {
$reflectionNamedType = $reflectionClass->getMethod($setterMethodName)->getParameters()[0]->getType();
/* @var $reflectionNamedType ReflectionNamedType */
$parameterClassName = $reflectionNamedType->getName();
if ($reflectionNamedType !== NULL) {
$parameterClassName = $reflectionNamedType->getName();

if (class_exists($parameterClassName)) {
$this->$setterMethodName(new $parameterClassName);
return $this->values[$name];
if (class_exists($parameterClassName)) {
$this->$setterMethodName(new $parameterClassName);
return $this->values[$name];
}
}
}

Expand Down

0 comments on commit e1fc837

Please sign in to comment.