fix #3709: NPE in auto-complete

It looks like at least on Android 3.1 the `getCount()` method may be
called before results are published.
refactoring: remove redundant variable
Merge branch 'release' into upstream