From e814dd106c302b0d0f96b3f04e1f06bd18d5b186 Mon Sep 17 00:00:00 2001 From: Andy Grundman Date: Sat, 21 Jun 2003 01:59:25 +0000 Subject: [PATCH] Added more error checking to unconditionalRead so the page doesn't die on invalid SQL --- lib/WebGUI/SQL.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/WebGUI/SQL.pm b/lib/WebGUI/SQL.pm index cc3073c5c..5661ce824 100644 --- a/lib/WebGUI/SQL.pm +++ b/lib/WebGUI/SQL.pm @@ -596,8 +596,10 @@ sub unconditionalRead { my ($sth,$dbh); $dbh = $_[2] || $WebGUI::Session::session{dbh}; $sth = $dbh->prepare($_[1]) or WebGUI::ErrorHandler::warn("Unconditional read failed: ".$_[1]." : ".DBI->errstr); - $sth->execute or WebGUI::ErrorHandler::warn("Unconditional read failed: ".$_[1]." : ".DBI->errstr); - bless ({_sth => $sth}, $_[0]); + if ($sth) { + $sth->execute or WebGUI::ErrorHandler::warn("Unconditional read failed: ".$_[1]." : ".DBI->errstr); + bless ({_sth => $sth}, $_[0]); + } }