From 98baec5c4e8bf6ed1a629127f54a52b9aa1c564e Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Mon, 5 Mar 2007 12:53:57 +0000 Subject: [PATCH] Make robust against $rs->record() failure. (Should never happen, but sometimes does.) --- lib/ZOOM/IRSpy/Test/ResultSet/Named.pm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/ZOOM/IRSpy/Test/ResultSet/Named.pm b/lib/ZOOM/IRSpy/Test/ResultSet/Named.pm index 346b4ec..8bc7625 100644 --- a/lib/ZOOM/IRSpy/Test/ResultSet/Named.pm +++ b/lib/ZOOM/IRSpy/Test/ResultSet/Named.pm @@ -1,4 +1,4 @@ -# $Id: Named.pm,v 1.2 2007-02-23 15:03:44 mike Exp $ +# $Id: Named.pm,v 1.3 2007-03-05 12:53:57 mike Exp $ # See the "Main" test package for documentation @@ -31,9 +31,17 @@ sub completed_search_a { my $record = ''; my $hits = $rs->size(); - ## How should be handle the situation when there is 0 hits? + ## How should we handle the situation when there is 0 hits? if ($hits > 0) { - $record = $rs->record(0)->raw(); + my $rsrec = $rs->record(0); + if (!defined $rsrec) { + # I thought this was a "can't happen", but it sometimes + # does, as for example documented for + # kat.vkol.cz:9909/svk02 at ../../../../../tmp/bad-run-1 + eval { $conn->check() }; + return error($conn, $task, $test_args, $@); + } + $record = $rsrec->raw(); } $conn->irspy_search_pqf("\@attr 1=4 4ds9da94", -- 1.7.10.4