Index: trunk/kernel/include/item.php
===================================================================
diff -u -r341 -r389
--- trunk/kernel/include/item.php (.../item.php) (revision 341)
+++ trunk/kernel/include/item.php (.../item.php) (revision 389)
@@ -779,14 +779,16 @@
$db =& $this->adodbConnection;
$sql = sprintf('SELECT * FROM %s WHERE CategoryId = %s AND ItemResourceId = %s', $SourceTable, $CatId, $this->Get("ResourceId"));
$rs = $db->Execute($sql);
- if($rs->RecordCount() == 0 )
- {
- $sql = "INSERT INTO $SourceTable (CategoryId,ItemResourceId, PrimaryCat) VALUES ('$CatId','".$this->Get("ResourceId")."',$Primary)";
- if($this->debuglevel)
- echo $sql."
\n";
- $this->adodbConnection->Execute($sql);
- }
-
+
+ if (is_object($rs)) {
+ if($rs->RecordCount() == 0 )
+ {
+ $sql = "INSERT INTO $SourceTable (CategoryId,ItemResourceId, PrimaryCat) VALUES ('$CatId','".$this->Get("ResourceId")."',$Primary)";
+ if($this->debuglevel)
+ echo $sql."
\n";
+ $this->adodbConnection->Execute($sql);
+ }
+ }
$c = $objCatList->GetCategory($CatId);
}