Factoids: Fix typo and edge case

This commit is contained in:
Pragmatic Software 2020-06-11 23:34:53 -07:00
parent c95afe65bc
commit 90b23d5391
1 changed files with 10 additions and 2 deletions

View File

@ -750,7 +750,7 @@ sub expand_factoid_vars {
my $var;
my $extract_method;
if ($action =~ /^\{.*?\}/) {
if ($rest =~ /^\{.*?\}/) {
($var, $rest) = $self->{pbot}->{interpreter}->extract_bracketed($rest, '{', '}');
if ($var =~ /:/) {
@ -847,7 +847,15 @@ sub expand_factoid_vars {
}
}
last if $matches == 0 or $expansions == 0;
if ($matches == 0 or $expansions == 0) {
if (length $rest) {
$rest = $result . $rest;
$result = '';
next;
} else {
last;
}
}
if (not length $rest) {
$rest = $result;