FIX: Better error message when GridFieldLevelup passed bad record details

Fixes https://github.com/silverstripe/silverstripe-framework/issues/3519
This commit is contained in:
Sam Minnee 2019-04-08 18:09:51 +12:00
parent d295888838
commit f12fa62ad6

View File

@ -62,6 +62,11 @@ class GridFieldLevelup implements GridField_HTMLProvider
/** @var DataObject|Hierarchy $modelObj */ /** @var DataObject|Hierarchy $modelObj */
$modelObj = DataObject::get_by_id($modelClass, $this->currentID); $modelObj = DataObject::get_by_id($modelClass, $this->currentID);
if (!$modelObj) {
throw new \LogicException(
"Can't find object of class $modelClass ID #{$this->currentID} for GridFieldLevelup"
);
}
$parent = null; $parent = null;
if ($modelObj->hasMethod('getParent')) { if ($modelObj->hasMethod('getParent')) {