MINOR LeftAndMain::getRecord check $ClassName before use

While the check for `$classname` was done in the first conditional, it was left out of the other two, leading to potential issues when an invalid ID was given, instead of the expected `false`.
This commit is contained in:
Stephen Shkardoon 2014-05-05 19:26:05 +12:00
parent fc8da3fb1d
commit 677f0edcfc

View File

@ -627,9 +627,9 @@ class LeftAndMain extends Controller implements PermissionProvider {
$className = $this->stat('tree_class'); $className = $this->stat('tree_class');
if($className && $id instanceof $className) { if($className && $id instanceof $className) {
return $id; return $id;
} else if($id == 'root') { } else if($className && $id == 'root') {
return singleton($className); return singleton($className);
} else if(is_numeric($id)) { } else if($className && is_numeric($id)) {
return DataObject::get_by_id($className, $id); return DataObject::get_by_id($className, $id);
} else { } else {
return false; return false;