BUG: read_table and read_csv crash (#22748)
State: closed

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


Labels:
name: Bug
name: IO CSV
description: read_csv, to_csv

Comments:
Hello @troels! Thanks for submitting the PR.

 - There are no PEP8 issues in the file [`pandas/tests/io/parser/c_parser_only.py`](https://github.com/troels/pandas/blob/b92bc822010d92d6aad8d42b3ea2447370b410fb/pandas/tests/io/parser/c_parser_only.py) !


# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22750?src=pr&el=h1) Report
> Merging [#22750](https://codecov.io/gh/pandas-dev/pandas/pull/22750?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/945bf75103f3465a5d937a661a0baf9bc156db6b?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/22750/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/22750?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #22750      +/-   ##
==========================================
+ Coverage   92.18%   92.18%   +<.01%     
==========================================
  Files         169      169              
  Lines       50812    50820       +8     
==========================================
+ Hits        46842    46850       +8     
  Misses       3970     3970
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.6% <ø> (ø)` | :arrow_up: |
| #single | `42.38% <ø> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/22750?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/22750/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `85.82% <0%> (-0.21%)` | :arrow_down: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/22750/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `96.67% <0%> (ø)` | :arrow_up: |
| [pandas/core/indexes/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/22750/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZWxpa2UucHk=) | `98.1% <0%> (+0.01%)` | :arrow_up: |
| [pandas/core/ops.py](https://codecov.io/gh/pandas-dev/pandas/pull/22750/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvb3BzLnB5) | `97.37% <0%> (+0.29%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22750?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22750?src=pr&el=footer). Last update [945bf75...e71abb6](https://codecov.io/gh/pandas-dev/pandas/pull/22750?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

tiny change. ping on green. @gfyoung merge when pushed and green.
Thanks @troels !