[Bps-public-commit] rt-extension-rest2 branch master updated: Skip not-existing custom fields

sunnavy sunnavy at bestpractical.com
Mon Jul 19 21:04:49 UTC 2021


This is an automated email from the git hooks/post-receive script.

sunnavy pushed a commit to branch master
in repository rt-extension-rest2.

The following commit(s) were added to refs/heads/master by this push:
     new 7a0e515  Skip not-existing custom fields
7a0e515 is described below

commit 7a0e515b1dfe6f469cd90936bee154e7b4a0b486
Author: sunnavy <sunnavy at bestpractical.com>
AuthorDate: Tue Jul 20 04:48:58 2021 +0800

    Skip not-existing custom fields
    
    If the custom field does not exist, the following
    $cf->ObjectTypeFromLookupType returns undef, which causes errors like:
    
        Can't call method "isa" on an undefined value
---
 lib/RT/Extension/REST2/Util.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/RT/Extension/REST2/Util.pm b/lib/RT/Extension/REST2/Util.pm
index 59e9e8c..429901a 100644
--- a/lib/RT/Extension/REST2/Util.pm
+++ b/lib/RT/Extension/REST2/Util.pm
@@ -284,7 +284,7 @@ sub update_custom_fields {
         my $val = $data->{$cfid};
 
         my $cf = $record->LoadCustomFieldByIdentifier($cfid);
-        next unless $cf->ObjectTypeFromLookupType($cf->__Value('LookupType'))->isa(ref $record);
+        next unless $cf->Id && $cf->ObjectTypeFromLookupType($cf->__Value('LookupType'))->isa(ref $record);
 
         if ($cf->SingleValue) {
             my %args;

-- 
To stop receiving notification emails like this one, please contact
sysadmin at bestpractical.com.


More information about the Bps-public-commit mailing list