Check fptr before trying to dump FILE object fd

Check that `fptr` is not NULL before dereferencing in `dump_object`.