I am using realm and I have the code
realm = Realm.getDefaultInstance();
realm.beginTransaction();
RealmQuery<LogEntry> query = realm.where(LogEntry.class);
To query for results. Occasionally however this throws
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'io.realm.RealmQuery io.realm.Realm.where(java.lang.Class)' on a null object reference
Error. How can I prevent this?
