summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/mg.c b/mg.c
index 0ac07420f4..821c32537d 100644
--- a/mg.c
+++ b/mg.c
@@ -261,6 +261,8 @@ MAGIC*
Perl_mg_find(pTHX_ SV *sv, int type)
{
MAGIC* mg;
+ if (!sv)
+ return 0;
for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) {
if (mg->mg_type == type)
return mg;