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 Jun 10, 2024
1 parent 0ac52e6 commit 01ab40a
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions Kernel/Modules/AgentReferenceSearch.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# --
# OTOBO is a web-based ticketing system for service organisations.
# --
# Copyright (C) 2019-2024 Rother OSS GmbH, https://otobo.de/
# Copyright (C) 2019-2024 Rother OSS GmbH, https://otobo.io/
# --
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
Expand Down 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 01ab40a

Please sign in to comment.