From 2f39c1317bbbf004fc833361381df4d664d49743 Mon Sep 17 00:00:00 2001
From: Tomas Cohen Arazi <tomascohen@theke.io>
Date: Tue, 2 Feb 2021 16:39:40 -0300
Subject: [PATCH] Bug 26636: (QA follow-up) Handle no results correctly

Sponsored-by: Virginia Polytechnic Institute and State University

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
---
 Koha/REST/Plugin/Objects.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Koha/REST/Plugin/Objects.pm b/Koha/REST/Plugin/Objects.pm
index 5fc6303020..7ccc1c4cf4 100644
--- a/Koha/REST/Plugin/Objects.pm
+++ b/Koha/REST/Plugin/Objects.pm
@@ -64,6 +64,8 @@ the requested object. It passes through any embeds if specified.
 
             my $object = $result_set->find( $id, $attributes );
 
+            return unless $object;
+
             return $object->to_api({ embed => $embed });
         }
     );
-- 
2.20.1