From 28d84b5486cfd87c5e9882d552367408e30bbb42 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Thu, 26 Feb 2015 21:42:41 +0000 Subject: fix a segfault when callbacks don't get a header --- URPM.xs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'URPM.xs') diff --git a/URPM.xs b/URPM.xs index f4ac459..40e3c46 100644 --- a/URPM.xs +++ b/URPM.xs @@ -1314,8 +1314,12 @@ static void *rpmRunTransactions_callback(const void *arg, mPUSHs(newSViv(total)); } // for erasures, the key provided by librpm is always 0, so let's add another parameter (fullname): - char *s = headerGetAsString(h, RPMTAG_NVR); - mPUSHs(newSVpv(s, 0)); + if (h) { + char *s = headerGetAsString(h, RPMTAG_NVR); + mPUSHs(newSVpv(s, 0)); + } else { + PUSHs(&PL_sv_undef); + } PUTBACK; i = call_sv(callback, callback == td->callback_open ? G_SCALAR : G_DISCARD); SPAGAIN; -- cgit v1.2.1