Skip to content

Commit

Permalink
Issue #3186: Enhanced error handling in AgentReferenceSearch.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanhaerter committed Sep 26, 2024
1 parent 6573c07 commit f6c0d8f
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions Kernel/Modules/AgentReferenceSearch.pm
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,14 @@ sub Run {
my $InitialDynamicFieldConfig = $Kernel::OM->Get('Kernel::System::DynamicField')->DynamicFieldGet(
Name => $FieldName,
);
return unless IsHashRefWithData($InitialDynamicFieldConfig);
if ( !IsHashRefWithData($InitialDynamicFieldConfig) ) {
return $LayoutObject->JSONReply(
Data => {
Success => 0,
Messsage => qq{Error reading the dynamic field '$FieldName'!},
},
);
}

# Check if we deal with a reference field
my $IsReferenceField = $DynamicFieldBackendObject->HasBehavior(
Expand All @@ -129,7 +136,14 @@ sub Run {
$DynamicFieldConfig = $Kernel::OM->Get('Kernel::System::DynamicField')->DynamicFieldGet(
ID => $InitialDynamicFieldConfig->{Config}{AttributeDF},
);
return unless IsHashRefWithData($DynamicFieldConfig);
if ( !IsHashRefWithData($InitialDynamicFieldConfig) ) {
return $LayoutObject->JSONReply(
Data => {
Success => 0,
Messsage => qq{Error reading the dynamic field '$FieldName'!},
},
);
}

$IsReferenceField = $DynamicFieldBackendObject->HasBehavior(
DynamicFieldConfig => $DynamicFieldConfig,
Expand All @@ -141,7 +155,7 @@ sub Run {
Data => {
Success => 0,
Messsage => qq{Error reading the dynamic field '$FieldName'!},
}
},
);
}
}
Expand Down

0 comments on commit f6c0d8f

Please sign in to comment.