fix interplay of humanize and html_escape

Fix this error when `humanize` is used together with `ERB::Util.html_escape`:

```
[1] pry(main)> ERB::Util.html_escape("hello").humanize
NoMethodError: undefined method `upcase' for nil:NilClass
```

Looks like it was introduced in PR #12789, and is related to #3496.