Bug 33702: (QA follow-up) Do not crash on borrowernumber

Resolve:
Can't call method "borrowernumber" on an undefined value at /usr/share/koha/opac/opac-illrequests.pl line 66

Test plan:
Put an unexisting illrequest_id in the URL parameter.
You should see a 404, not a crash.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Marcel de Rooy 2023-05-12 06:56:07 +00:00 committed by Tomas Cohen Arazi
parent b5cae12aef
commit 4ede366268
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 1 additions and 1 deletions

View File

@ -63,7 +63,7 @@ my ( $illrequest_id, $request );
if ( $illrequest_id = $params->{illrequest_id} ) {
$request = Koha::Illrequests->find($illrequest_id);
# Make sure the request belongs to the logged in user
unless ( $request->borrowernumber == $loggedinuser ) {
if( !$request || $request->borrowernumber != $loggedinuser ) {
print $query->redirect("/cgi-bin/koha/errors/404.pl");
exit;
}