diff --git a/app/src/main/java/jackall/devrealm/db/PersonRealmHelper.kt b/app/src/main/java/jackall/devrealm/db/PersonRealmHelper.kt index 01a5beb..3bd832c 100644 --- a/app/src/main/java/jackall/devrealm/db/PersonRealmHelper.kt +++ b/app/src/main/java/jackall/devrealm/db/PersonRealmHelper.kt @@ -24,7 +24,10 @@ return query.findAll() } - fun findLast(): Person { - return query.findAll().last() + fun findLast(): Person? { + val results = query.findAll() + if (results.isEmpty()) + return null + return results.last() } } \ No newline at end of file