Skip to content

Commit

Permalink
Merge pull request #12 from Stratosgear/master
Browse files Browse the repository at this point in the history
Catch a null pointer exception
  • Loading branch information
phpnode committed Jun 11, 2012
2 parents d5f02c7 + 55fd842 commit 745deb3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions ASolrSearchable.php
Expand Up @@ -168,8 +168,7 @@ public function getSolrDocument($refresh = false)
foreach($this->resolveAttributes() as $attribute => $item) {
list($object, $property) = $item;
$resolvedAttributeName = $this->resolveAttributeName($attribute);
if (is_object($object))
$this->_solrDocument->{$resolvedAttributeName} = $object->{$property};
$this->_solrDocument->{$resolvedAttributeName} = isset($object) ? $object->{$property} : null;
}
}
return $this->_solrDocument;
Expand All @@ -187,8 +186,7 @@ public function index() {
$this->_oldAttributes = array();
foreach($this->resolveAttributes() as $key => $item) {
list($object, $property) = $item;
if (is_object($object))
$this->_oldAttributes[$key] = $object->{$property};
$this->_oldAttributes[$key] = isset($object) ? $object->{$property} : null;
}
return true;
}
Expand Down

0 comments on commit 745deb3

Please sign in to comment.