mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-29 20:59:23 +02:00
FIX readonly PermissionCheckboxSetField
A readonly PermissionCheckboxSetField (eg in Security when viewing a member without permission to edit it) can result in calling "getRecord()" on null. Add is_object check, consistent with line 98.
This commit is contained in:
parent
5164f003d9
commit
b8e5a2ce32
@ -242,7 +242,7 @@ class PermissionCheckboxSetField extends FormField
|
|||||||
// If the field is readonly, add a span that will replace the disabled checkbox input
|
// If the field is readonly, add a span that will replace the disabled checkbox input
|
||||||
if ($this->readonly) {
|
if ($this->readonly) {
|
||||||
$icon = ($checked) ? 'check-mark-circle' : 'cancel-circled';
|
$icon = ($checked) ? 'check-mark-circle' : 'cancel-circled';
|
||||||
$record = $this->form->getRecord();
|
$record = is_object($this->form) ? $this->form->getRecord() : false;
|
||||||
// Inherited codes are shown as a gray x
|
// Inherited codes are shown as a gray x
|
||||||
if ($record && $record instanceof Member &&
|
if ($record && $record instanceof Member &&
|
||||||
Permission::checkMember($record, 'ADMIN') && $code != 'ADMIN') {
|
Permission::checkMember($record, 'ADMIN') && $code != 'ADMIN') {
|
||||||
|
Loading…
Reference in New Issue
Block a user