Fixed crash in agenda on empty database.