Fixes #1985 by only calling getStats() when the elem array has items...

... (instead of just non-null).

Fixes #1985