MINOR If a FormField hasn't called parent::__construct() properly, throw an error before attempting to call ClassInfo::ancestry() on a NULL value

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@78129 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-05-29 02:11:41 +00:00
parent b0798db91e
commit 4da2743994

View File

@ -22,6 +22,9 @@ class FormTransformation extends Object {
// We iterate through each array simultaneously, looking at [0] of both, then [1] of both.
// This provides a more natural failover scheme.
if(!$field->class) {
user_error(get_class($field) . ' is missing a class property, please ensure constructors call parent', E_USER_ERROR);
}
$transNames = array_reverse(array_values(ClassInfo::ancestry($this->class)));
$fieldClasses = array_reverse(array_values(ClassInfo::ancestry($field->class)));