summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorjosh <twists@gmail.com>2007-10-14 14:37:08 -0700
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-10-17 08:17:29 +0000
commit1e1d4b91957a9f66bbb14b2c7f1bbf88c1f89cdf (patch)
treeab06c1b94ecf038d0bb7b80ad7e53a8ece4b28a3 /regcomp.c
parenta5a709ec819bfe84b1af6f781d5d87ef68e00c3a (diff)
downloadperl-1e1d4b91957a9f66bbb14b2c7f1bbf88c1f89cdf.tar.gz
Fix a few segfaults and a when() bug
From: "josh" <twists@gmail.com> Message-ID: <20071015043708.GA10981@grenekatz.org> p4raw-id: //depot/perl@32120
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/regcomp.c b/regcomp.c
index 99cb4645e9..3ad5d8c138 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -4944,9 +4944,13 @@ Perl_reg_named_buff_exists(pTHX_ REGEXP * const rx, SV * const key,
SV*
Perl_reg_named_buff_firstkey(pTHX_ REGEXP * const rx, const U32 flags)
{
- (void)hv_iterinit(rx->paren_names);
+ if ( rx && rx->paren_names ) {
+ (void)hv_iterinit(rx->paren_names);
- return CALLREG_NAMED_BUFF_NEXTKEY(rx, NULL, flags & ~RXapif_FIRSTKEY);
+ return CALLREG_NAMED_BUFF_NEXTKEY(rx, NULL, flags & ~RXapif_FIRSTKEY);
+ } else {
+ return FALSE;
+ }
}
SV*