/**********************************************************************
* plperl.c - perl as a procedural language for PostgreSQL
*
- * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.161 2010/01/26 23:11:56 adunstan Exp $
+ * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.162 2010/01/28 23:06:09 adunstan Exp $
*
**********************************************************************/
if (count == 1) {
GV *sub_glob = (GV*)POPs;
- if (sub_glob && SvTYPE(sub_glob) == SVt_PVGV)
- subref = newRV_inc((SV*)GvCVu((GV*)sub_glob));
+ if (sub_glob && SvTYPE(sub_glob) == SVt_PVGV) {
+ SV *sv = (SV*)GvCVu((GV*)sub_glob);
+ if (sv)
+ subref = newRV_inc(sv);
+ }
}
PUTBACK;