Only attempt to iterate through VPS list query results when the result isn't empty

feature/node-rewrite
Sven Slootweg 12 years ago
parent d6d1804fa2
commit 454d21946a

@ -15,10 +15,10 @@ if(!isset($_CVM)) { die("Unauthorized."); }
if($sLoggedIn === true)
{
$result = $database->CachedQuery("SELECT * FROM containers WHERE `UserId` = :UserId", array(":UserId" => $sUser->sId));
$sVpsList = array();
if($result = $database->CachedQuery("SELECT * FROM containers WHERE `UserId` = :UserId", array(":UserId" => $sUser->sId)))
{
foreach($result->data as $row)
{
$sVps = new Vps($row);
@ -46,6 +46,7 @@ if($sLoggedIn === true)
'virtualization-type' => $sVps->sVirtualizationType
);
}
}
$sMainContents = Templater::AdvancedParse("{$sTheme}/client/vps/list", $locale->strings, array(
'vpses' => $sVpsList

Loading…
Cancel
Save