From 82c8542cb6493c9d2ddc9a1f26c54d6aac675317 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 11 Dec 2019 09:39:30 +0100 Subject: [PATCH] Bug 24213: Fix Koha::Object->get_from_storage if the object has been deleted Without this patch it fails with something like: DBIC result _type isn't of the _type Subscription at t/db_dependent/Biblio.t line 627. Test plan: - Apply the first patch (Add tests) - Confirm that they fail - Apply this patch - Confirm that the tests pass Signed-off-by: Martin Renvoize Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize --- Koha/Object.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/Koha/Object.pm b/Koha/Object.pm index fd24e9947a..694835e238 100644 --- a/Koha/Object.pm +++ b/Koha/Object.pm @@ -280,6 +280,7 @@ sub unblessed { sub get_from_storage { my ( $self, $attrs ) = @_; my $stored_object = $self->_result->get_from_storage($attrs); + return unless $stored_object; my $object_class = Koha::Object::_get_object_class( $self->_result->result_class ); return $object_class->_new_from_dbic($stored_object); } -- 2.39.5