Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Check the table existence in the page and file picker (see #7346)
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Oct 3, 2014
1 parent 9c272cc commit c44fe47
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
13 changes: 8 additions & 5 deletions system/modules/core/controllers/BackendFile.php
Expand Up @@ -81,12 +81,15 @@ public function run()
$objDca->field = $strField;

// Set the active record
$strModel = \Model::getClassFromTable($strTable);
$objModel = $strModel::findByPk(\Input::get('id'));

if ($objModel !== null)
if (\Database::getInstance()->tableExists($strTable))
{
$objDca->activeRecord = $objModel;
$strModel = \Model::getClassFromTable($strTable);
$objModel = $strModel::findByPk(\Input::get('id'));

if ($objModel !== null)
{
$objDca->activeRecord = $objModel;
}
}

// AJAX request
Expand Down
13 changes: 8 additions & 5 deletions system/modules/core/controllers/BackendPage.php
Expand Up @@ -81,12 +81,15 @@ public function run()
$objDca->field = $strField;

// Set the active record
$strModel = \Model::getClassFromTable($strTable);
$objModel = $strModel::findByPk(\Input::get('id'));

if ($objModel !== null)
if (\Database::getInstance()->tableExists($strTable))
{
$objDca->activeRecord = $objModel;
$strModel = \Model::getClassFromTable($strTable);
$objModel = $strModel::findByPk(\Input::get('id'));

if ($objModel !== null)
{
$objDca->activeRecord = $objModel;
}
}

// AJAX request
Expand Down

0 comments on commit c44fe47

Please sign in to comment.