Fixing an NPE for users that install the statistics for the firts time

When the statistics database is empty, a NPE error occurs.