From a96819261f6ff1c71881653e8f9811068f6072ce Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Thu, 16 Dec 2021 03:08:22 +0000 Subject: [PATCH] Check that database exists before using for last article info --- Rocksolid_Light/rocksolid/lib/thread.inc.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Rocksolid_Light/rocksolid/lib/thread.inc.php b/Rocksolid_Light/rocksolid/lib/thread.inc.php index 3c10a8c..64071b2 100644 --- a/Rocksolid_Light/rocksolid/lib/thread.inc.php +++ b/Rocksolid_Light/rocksolid/lib/thread.inc.php @@ -814,15 +814,16 @@ function thread_format_lastmessage($c,$group='') { if($CONFIG['article_database'] == '1') { $database = $spooldir.'/'.$group.'-articles.db3'; $table = 'articles'; - $dbh = article_db_open($database, $table); - $stmt = $dbh->prepare("SELECT * FROM $table WHERE date=:date ORDER BY date DESC"); - $stmt->bindParam(':date', $c->date_thread); - $stmt->execute(); - if($found = $stmt->fetch()) { - $ovfound = 1; - }; - $dbh = null; - + if(is_file($database)) { + $dbh = article_db_open($database, $table); + $stmt = $dbh->prepare("SELECT * FROM $table WHERE date=:date ORDER BY date DESC"); + $stmt->bindParam(':date', $c->date_thread); + $stmt->execute(); + if($found = $stmt->fetch()) { + $ovfound = 1; + }; + $dbh = null; + } $fromline = address_decode(headerDecode($found['name']),"nirgendwo"); if (!isset($fromline[0]["host"])) $fromline[0]["host"]=""; $name_from=$fromline[0]["mailbox"]."@".$fromline[0]["host"];