Permalink
Browse files

Merge pull request #844 from dogmatic69/form-bug

Adding a check to the object before use
  • Loading branch information...
2 parents 1fe7913 + 6f3e6c1 commit 98992e021aa8c641e945b83bf24d51d6a60a9e6d @markstory markstory committed Sep 14, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/Cake/View/Helper/FormHelper.php
@@ -146,7 +146,7 @@ protected function _getModel($model) {
));
} elseif (ClassRegistry::isKeySet($this->defaultModel)) {
$defaultObject = ClassRegistry::getObject($this->defaultModel);
- if (in_array($model, array_keys($defaultObject->getAssociated()), true) && isset($defaultObject->{$model})) {
+ if ($defaultObject && in_array($model, array_keys($defaultObject->getAssociated()), true) && isset($defaultObject->{$model})) {
$object = $defaultObject->{$model};
}
} else {

0 comments on commit 98992e0

Please sign in to comment.