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
e43745cd86
commit
9eea40aeff
1 changed files with 6 additions and 3 deletions
|
|
@ -838,10 +838,13 @@ sub view {
|
|||
my $featuredIds = $self->getFeaturedPageIds;
|
||||
|
||||
if( @$featuredIds ) {
|
||||
# it's possible for a WikiMaster not to have any WikiPage featured; it's also possible for any to not render
|
||||
my $featuredId = $featuredIds->[ int( rand @$featuredIds ) - 1 ];
|
||||
my $featured = eval { WebGUI::Asset->newById( $session, $featuredId ) };
|
||||
if ( ! Exception::Class->caught() ) {
|
||||
$self->appendFeaturedPageVars( $var, $featured );
|
||||
if( $featuredId ) {
|
||||
my $featured = eval { WebGUI::Asset->newById( $session, $featuredId ) };
|
||||
if ( ! Exception::Class->caught() ) {
|
||||
$self->appendFeaturedPageVars( $var, $featured );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue