executeTransaction() throws NullPointerException
Goal
Calling Realm#executeTransaction() and DynamicRealm#executeTransaction() against closed instance throws IllegalStateException with message This Realm instance has already been closed, making it unusable..
executeTransaction() should call checkIfValid() before calling checkAllowWritesOnUiThread().
Actual Results
Got java.lang.NullPointerException: Attempt to read from field 'io.realm.internal.Capabilities io.realm.internal.OsSharedRealm.capabilities' on a null object reference
Steps & Code to Reproduce
Calling Realm#executeTransaction() and DynamicRealm#executeTransaction() against closed Realm or DynamicRealm instance.
Version of Realm and tooling
Realm version(s): 10.6.0
Realm Sync feature enabled: both
Android Studio version: ?
Android Build Tools version: ?
Gradle version: ?
Which Android version and device(s): ?
Ups. Good catch 👍
@cmelchior DynamicRealm has the same issue https://github.com/realm/realm-java/blob/master/realm/realm-library/src/main/java/io/realm/DynamicRealm.java#L301