BUG: read_table and read_csv crash (#22748)
A missing null-pointer check made read_table and read_csv prone
to crash on badly encoded text. Add null-pointer check.

- [X] closes #22748
- [X] tests added / passed
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [X] whatsnew entry
