Index: t3lib/class.t3lib_admin.php =================================================================== --- t3lib/class.t3lib_admin.php (revision 6146) +++ t3lib/class.t3lib_admin.php (working copy) @@ -325,17 +325,26 @@ // Remove preceding "-1," for non-versioned tables $pid_list_tmp = preg_replace('/^\-1,/','',$pid_list_tmp); } + $garbage = NULL; + $label = $TCA[$table]['ctrl']['label']; - $garbage = $GLOBALS['TYPO3_DB']->exec_SELECTquery ( - 'uid,pid,'.$TCA[$table]['ctrl']['label'], - $table, - 'pid NOT IN ('.$pid_list_tmp.')' - ); - $lostIdList = array(); - while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($garbage)) { - $this->lRecords[$table][$row['uid']]=Array('uid'=>$row['uid'], 'pid'=>$row['pid'], 'title'=> strip_tags($row[$TCA[$table]['ctrl']['label']]) ); - $lostIdList[]=$row['uid']; + if ($label && $pid_list_tmp) { + $garbage = $GLOBALS['TYPO3_DB']->exec_SELECTquery ( + 'uid,pid,'.$TCA[$table]['ctrl']['label'], + $table, + 'pid NOT IN ('.$pid_list_tmp.')' + ); } + + if ($garbage) { + $lostIdList = array(); + while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($garbage)) { + $this->lRecords[$table][$row['uid']]=Array('uid'=>$row['uid'], 'pid'=>$row['pid'], 'title'=> strip_tags($row[$TCA[$table]['ctrl']['label']]) ); + $lostIdList[]=$row['uid']; + } + $GLOBALS['TYPO3_DB']->sql_free_result($garbage); + } + if ($table=='pages') { $this->lostPagesList=implode(',',$lostIdList); }