realm / realm-java

Realm is a mobile database: a replacement for SQLite & ORMs
http://realm.io
Apache License 2.0
11.45k stars 1.75k forks source link

Fix NetworkRequest being able to return invalid values #7849

Closed cmelchior closed 8 months ago

cmelchior commented 8 months ago

Closes #7848

It turns out it was possible to get into a situation where a NetworkRequest would sometimes return null even though it shouldn't. This could happen if you cancel the RealmAsyncTask controlling the network request while the request was running.

It wasn't possible to add a unit test that would fail consistently in that case, so Instead I added something more low-level that ensured that we failed correctly if the request was interrupted.