diff options
author | David Mitchell <davem@iabyn.com> | 2013-11-18 14:52:57 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2013-11-18 17:14:22 +0000 |
commit | 63d83481e2cd52a64f36a54ea50d29ca81aca410 (patch) | |
tree | f060202b17553330dbfe51eeb62587fbd2ef556b /ext | |
parent | 8380d35aa2712976e84a271f136604befc69b5a3 (diff) | |
download | perl-63d83481e2cd52a64f36a54ea50d29ca81aca410.tar.gz |
PerlIO::via: fix compiler warning
In
GV *gv = newGVgen(HvNAME_get(s->stash))
HvNAME_get() can return a null value (don't know whether it ever will in
these circumstances), while newGVgen() expects a non-null arg.
So calculate HvNAME_get() first, and bail if it's null.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/PerlIO-via/via.pm | 2 | ||||
-rw-r--r-- | ext/PerlIO-via/via.xs | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/ext/PerlIO-via/via.pm b/ext/PerlIO-via/via.pm index 601be80bbc..2fa37b136c 100644 --- a/ext/PerlIO-via/via.pm +++ b/ext/PerlIO-via/via.pm @@ -1,5 +1,5 @@ package PerlIO::via; -our $VERSION = '0.12'; +our $VERSION = '0.13'; require XSLoader; XSLoader::load(); 1; diff --git a/ext/PerlIO-via/via.xs b/ext/PerlIO-via/via.xs index 56889bfef6..95ccb3ac38 100644 --- a/ext/PerlIO-via/via.xs +++ b/ext/PerlIO-via/via.xs @@ -87,7 +87,12 @@ PerlIOVia_method(pTHX_ PerlIO * f, const char *method, CV ** save, int flags, } if (*PerlIONext(f)) { if (!s->fh) { - GV *gv = newGVgen(HvNAME_get(s->stash)); + GV *gv; + char *package = HvNAME_get(s->stash); + + if (!package) + return Nullsv; /* can this ever happen? */ + gv = newGVgen(package); GvIOp(gv) = newIO(); s->fh = newRV((SV *) gv); s->io = GvIOp(gv); |