I haven't really tried, but the code cleary relies on an $recall->checkout returning a Koha::Checkout object... Which shouldn't be taken for granted. The way it is constructed is fragile and makes the controller need to perform all the checks, that really belong here. It should probably throw an exception as well. Right now the code can generate a recall object (store it on the DB) and then explode because of the lack of the checkout. This also points to the need of a transaction.