p4raw-id: //depot/perl@22578
/* if it's a special scalar or if it has no 'set' magic,
* propagate the SvREADONLY flag. --rgs 20030922 */
for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) {
- if (SvMAGIC(sv)->mg_type == '\0'
- || !SvMAGIC(sv)->mg_virtual->svt_set)
+ if (mg->mg_type == '\0'
+ || !(mg->mg_virtual && mg->mg_virtual->svt_set))
{
SvFLAGS(sv) |= SvREADONLY(osv);
break;