Make sure error pointer exists before assigning to it