I'm getting this error when trying to update an objet from realm (0.82.1):
rowIndex > available rows: 0 > 0
Realm realm = null;
try{
realm = Realm. getInstance ( context );
RealmResults<Track> results = realm.allObjects( Track.class )
.where()
.equalTo("fileType", type)
.equalTo("fileState", actualState)
.equalTo("fileName", fileName)
.findAll();
//At this point result.size() = 1
for( int i = 0; i < results.size(); i++ )
{
realm.beginTransaction();
results.get( i ).setFileState(newState);
realm.commitTransaction();
}
}catch ( RealmException e ) {
Log.d( TAG, e.getMessage());
}catch ( RealmIOException e ) {
Log.d( TAG, e.getMessage());
}catch ( Exception e ) {
Log.d( TAG, e.getMessage());
}
finally {
if (realm != null) {
realm.close();
}
}
I have tried also with Iterator but I have the same error.
Summary:
- It crashes every time. (I've seen it multiple times)
- It is reproducable.
- Experienced crashes on Android 4.4.4 (Samsung Galaxy S3), 5.0.1 (Samsung Galaxy Note4)
The crash is in the for loop. I capture the exception that is:
rowIndex 0 > 0 - invalid!
jni: ThrowingException 7, rowIndex > available rows: 0 > 0
Any solution?