From 1230fc2950e02f8fd5c43e6efb418fdc9e24e0be Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 25 Jan 2024 23:22:25 +0200 Subject: [PATCH] fix content availability check --- src/server.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/server.php b/src/server.php index e1cb450..cb128ca 100644 --- a/src/server.php +++ b/src/server.php @@ -91,11 +91,14 @@ foreach ((array) scandir(__DIR__ . '/../host') as $host) $config ); - $response->setContent( - $room->list() - ); + if ($list = $room->list()) + { + $response->setContent( + $list + ); - return $response; + return $response; + } // Dynamical requests default: @@ -111,13 +114,14 @@ foreach ((array) scandir(__DIR__ . '/../host') as $host) $config ); - $response->setContent( - $room->posts( - $matches[1] - ) - ); + if ($posts = $room->posts($matches[1])) + { + $response->setContent( + $posts + ); - return $response; + return $response; + } } } }