Skip to content

Commit

Permalink
Item13347: istopic on empty topic name returns true
Browse files Browse the repository at this point in the history
  • Loading branch information
gac410 committed Apr 2, 2015
1 parent 68482cc commit 250428d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions UnitTestContrib/test/unit/Fn_IF.pm
Expand Up @@ -1175,6 +1175,17 @@ sub test_93b {
return;
}

sub test_Item13347 {
my $this = shift;
$this->simpleTest(
test => "istopic ''",
then => 0,
else => 1
);

return;
}

sub test_93c {
my $this = shift;
$this->simpleTest(
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Foswiki/If/OP_istopic.pm
Expand Up @@ -36,7 +36,7 @@ sub evaluate {
'No context in which to evaluate "' . $a->stringify() . '"' )
unless $session;
my ( $web, $topic ) = ( $session->{webName}, $a->_evaluate(@_) );
return 0 unless defined $topic; # null topic cannot possibly exist
return 0 unless $topic; # null/empty topic cannot possibly exist
( $web, $topic ) = $session->normalizeWebTopicName( $web, $topic );
return $session->topicExists( $web, $topic ) ? 1 : 0;
}
Expand Down

0 comments on commit 250428d

Please sign in to comment.