Don't blow up on view when there are no WebGUI::Asset::WikiPage
child objects under us to feature. Also, the only reason that -1 on the rand works is because Perl is nice.
This commit is contained in:
parent
c1a918493f
commit
d57d9ff962
1 changed files with 7 additions and 4 deletions
|
|
@ -836,10 +836,13 @@ sub view {
|
|||
|
||||
# Get a random featured page
|
||||
my $featuredIds = $self->getFeaturedPageIds;
|
||||
my $featuredId = $featuredIds->[ int( rand @$featuredIds ) - 1 ];
|
||||
my $featured = WebGUI::Asset->newById( $session, $featuredId );
|
||||
if ( $featured ) {
|
||||
$self->appendFeaturedPageVars( $var, $featured );
|
||||
|
||||
if( @$featuredIds ) {
|
||||
my $featuredId = $featuredIds->[ int( rand @$featuredIds ) - 1 ];
|
||||
my $featured = WebGUI::Asset->newById( $session, $featuredId );
|
||||
if ( $featured ) {
|
||||
$self->appendFeaturedPageVars( $var, $featured );
|
||||
}
|
||||
}
|
||||
|
||||
$self->appendSearchBoxVars($var);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue