Dereference token_re on older Perls Broken in commit 633c4d3.
Fixes LUCY-297. Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/4ad771ce Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/4ad771ce Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/4ad771ce Branch: refs/heads/0.5 Commit: 4ad771cebc12dbaf794ebb81be5628386e0b96ce Parents: 50d01c1 Author: Nick Wellnhofer <wellnho...@aevum.de> Authored: Mon Apr 4 17:59:56 2016 +0200 Committer: Nick Wellnhofer <wellnho...@aevum.de> Committed: Tue Apr 5 11:53:49 2016 +0200 ---------------------------------------------------------------------- perl/xs/Lucy/Analysis/RegexTokenizer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/4ad771ce/perl/xs/Lucy/Analysis/RegexTokenizer.c ---------------------------------------------------------------------- diff --git a/perl/xs/Lucy/Analysis/RegexTokenizer.c b/perl/xs/Lucy/Analysis/RegexTokenizer.c index f8e5e36..667015e 100644 --- a/perl/xs/Lucy/Analysis/RegexTokenizer.c +++ b/perl/xs/Lucy/Analysis/RegexTokenizer.c @@ -58,9 +58,13 @@ lucy_RegexTokenizer_init(lucy_RegexTokenizer *self, #if (PERL_VERSION > 10) REGEXP *rx = SvRX((SV*)token_re); #else + if (!SvROK(token_re)) { + THROW(CFISH_ERR, "token_re is not a qr// entity"); + } + SV *inner = SvRV(token_re); MAGIC *magic = NULL; - if (SvMAGICAL((SV*)token_re)) { - magic = mg_find((SV*)token_re, PERL_MAGIC_qr); + if (SvMAGICAL((SV*)inner)) { + magic = mg_find((SV*)inner, PERL_MAGIC_qr); } if (!magic) { THROW(CFISH_ERR, "token_re is not a qr// entity");