From c9f49d84763e303af97da7664d29a8bcacae1280 Mon Sep 17 00:00:00 2001 From: Daniel Kinzler Date: Tue, 1 Jul 2008 20:49:23 +0000 Subject: [PATCH] allow Category objects for empty categories --- includes/Category.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/includes/Category.php b/includes/Category.php index 43864914e4..45d2afa2e4 100644 --- a/includes/Category.php +++ b/includes/Category.php @@ -46,7 +46,18 @@ class Category { ); if( !$row ) { # Okay, there were no contents. Nothing to initialize. - return false; + if ( $this->mTitle ) { + # If there is a title object but no record in the category table, treat this as an empty category + $this->mID = false; + $this->mName = $this->mTitle->getDBKey(); + $this->mPages = 0; + $this->mSubcats = 0; + $this->mFiles = 0; + + return true; + } else { + return false; # Fail + } } $this->mID = $row->cat_id; $this->mName = $row->cat_title; -- 2.20.1