PGS Subs: Don't read from null ptr and Flush on error
Merge pull request #5617 from fritsch/pgs_subs

FIX: PGS Subs: Don't read from null ptr