Fix bug 5842.

The bug is caused by rehash producing an AA with a zero-size hashtable
when called on an empty but non-null AA.