summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2013-11-18 14:52:57 +0000
committerDavid Mitchell <davem@iabyn.com>2013-11-18 17:14:22 +0000
commit63d83481e2cd52a64f36a54ea50d29ca81aca410 (patch)
treef060202b17553330dbfe51eeb62587fbd2ef556b /ext
parent8380d35aa2712976e84a271f136604befc69b5a3 (diff)
downloadperl-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.pm2
-rw-r--r--ext/PerlIO-via/via.xs7
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);