diff --git a/filter/rastertopwg.c b/filter/rastertopwg.c
index 1e63e4e..b3a2e87 100644
--- a/filter/rastertopwg.c
+++ b/filter/rastertopwg.c
@@ -260,7 +260,8 @@ main(int  argc,				/* I - Number of command-line args */
     }
 
     if (inheader.cupsPageSizeName[0] &&
-        (pwg_size = _ppdCacheGetSize(cache, inheader.cupsPageSizeName)) != NULL)
+        (pwg_size = _ppdCacheGetSize(cache, inheader.cupsPageSizeName)) != NULL &&
+        pwg_size->map.pwg)
     {
       strlcpy(outheader.cupsPageSizeName, pwg_size->map.pwg,
 	      sizeof(outheader.cupsPageSizeName));
