From b8e5a2ce322eb1f0c7d54111a69a8fdf01dbf9bf Mon Sep 17 00:00:00 2001 From: Mike Cochrane Date: Mon, 25 Sep 2017 15:25:10 +1300 Subject: [PATCH] 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. --- src/Security/PermissionCheckboxSetField.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Security/PermissionCheckboxSetField.php b/src/Security/PermissionCheckboxSetField.php index 3ffd11e93..ef9016d12 100644 --- a/src/Security/PermissionCheckboxSetField.php +++ b/src/Security/PermissionCheckboxSetField.php @@ -242,7 +242,7 @@ class PermissionCheckboxSetField extends FormField // If the field is readonly, add a span that will replace the disabled checkbox input if ($this->readonly) { $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 if ($record && $record instanceof Member && Permission::checkMember($record, 'ADMIN') && $code != 'ADMIN') {