Skip to content

Commit 30d5020

Browse files
committed
Avoid returning a C NULL.
1 parent 8d1f7f6 commit 30d5020

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/ops/nqp.ops

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,11 +1949,14 @@ is none.
19491949

19501950
*/
19511951
inline op nqp_get_sc_for_object(out PMC, invar PMC) :base_core {
1952-
if ($2->vtable->base_type == smo_id)
1953-
$1 = SC_PMC($2);
1954-
else
1952+
if ($2->vtable->base_type == smo_id) {
1953+
PMC *result = SC_PMC($2);
1954+
$1 = result ? result : PMCNULL;
1955+
}
1956+
else {
19551957
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
19561958
"Can only use nqp_get_sc_for_object with a SixModelObject");
1959+
}
19571960
}
19581961

19591962

0 commit comments

Comments
 (0)