Index: branches/5.2.x/units/posts/post_eh.php =================================================================== diff -u -N -r15148 -r15249 --- branches/5.2.x/units/posts/post_eh.php (.../post_eh.php) (revision 15148) +++ branches/5.2.x/units/posts/post_eh.php (.../post_eh.php) (revision 15249) @@ -1,6 +1,6 @@ GetDBField('TopicId'); if ( !$topic_id ) { - // deleting non-existing post + // deleting post from non-existing topic return; } @@ -361,6 +361,11 @@ $main_object->Load($topic_id); + if ( !$main_object->isLoaded() ) { + // this is topic deletion proccess, when all it's posts are deleted too + return; + } + $post_helper->updateTodayPostsCount($main_object, $object->GetDBField('CreatedOn'), -1); if ( $main_object->GetDBField('LastPostId') == $object->GetID() ) {