Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #12 from Stratosgear/master

Catch a null pointer exception
  • Loading branch information...
commit 745deb3303e3d04453c5eba06c9876c48f2f0a3c 2 parents d5f02c7 + 55fd842
@phpnode authored
Showing with 2 additions and 4 deletions.
  1. +2 −4 ASolrSearchable.php
View
6 ASolrSearchable.php
@@ -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;
@@ -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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.