diff --git a/inc/html.php b/inc/html.php
index 6bf1921..058c449 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -824,7 +824,7 @@ function rebuildThread($id) {
$id = intval($id);
$post = postByID($id);
- if ($post['moderated'] == 0) {
+ if (empty($post) || $post['moderated'] == 0) {
@unlink('res/' . $id . '.html');
return;
}