Fix for when there is no user in cache
parent
54c748fb29
commit
5e4e1692e6
|
@ -15,7 +15,12 @@ public class UserDAO extends RealmDAO<User> {
|
|||
}
|
||||
|
||||
public User findUserById(Realm realm, int id) {
|
||||
return realm.copyFromRealm(realm.where(entityClass).equalTo(User.PRIMARY_KEY, id).findFirst());
|
||||
User user = realm.where(entityClass).equalTo(User.PRIMARY_KEY, id).findFirst();
|
||||
if(user != null) {
|
||||
return realm.copyFromRealm(user);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteById(Realm realm, int id) {
|
||||
|
|
Loading…
Reference in New Issue