Skip to content

Commit

Permalink
Ensure we don't produce something that will cause segfaults when unbo…
Browse files Browse the repository at this point in the history
…xing to a native str.
  • Loading branch information
jnthn committed Oct 8, 2011
1 parent 52e30a5 commit f0119d2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/6model/reprs/P6opaque.c
Expand Up @@ -695,7 +695,10 @@ static STRING * get_str(PARROT_INTERP, PMC *obj) {
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
"Cannot unbox type object to a native string");
}
return get_str_at_offset(instance, repr_data->unbox_str_offset);
else {
STRING *s = get_str_at_offset(instance, repr_data->unbox_str_offset);
return s ? s : STRINGNULL;
}
}
else {
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
Expand Down

0 comments on commit f0119d2

Please sign in to comment.