Fixing empty result array on error

This commit is contained in:
rootcoma 2013-11-30 04:40:24 -08:00
parent 520784ae28
commit fe7490fe5b
1 changed files with 1 additions and 4 deletions

View File

@ -109,6 +109,7 @@ function replaceTimespanVariable($t) {
<h2>Top Scores for <?php echo $timeDesc; ?></h2>
<?php
$resultCount = 0;
$result = array();
try {
if ($timespan == 'w') {
$result = $storage->getWeekTopScores($page, $maxResults);
@ -125,12 +126,8 @@ function replaceTimespanVariable($t) {
}
} catch(StorageSchemaException $e) {
echo "<div class='alert alert-error'>Error: Database schema is not queryable</div>";
$result = array();
$result[0] = array('round_num'=>'', 'channel'=>'', 'question'=>'', 'line_num'=>'');
} catch(StorageConnectionException $e) {
echo "<div class='alert alert-error'>Error: Database is not available</div>";
$result = array();
$result[0] = array('round_num'=>'', 'channel'=>'', 'question'=>'', 'line_num'=>'');
}
$storage->close();
?>