{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-java/issues/1266","labels_url":"https://api.github.com/repos/realm/realm-java/issues/1266/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-java/issues/1266/comments","events_url":"https://api.github.com/repos/realm/realm-java/issues/1266/events","html_url":"https://github.com/realm/realm-java/issues/1266","id":93241014,"number":1266,"title":"NullPointerException on Realm.java (v 0.81.1)","user":{"login":"elikohen","id":2521185,"avatar_url":"https://avatars.githubusercontent.com/u/2521185?v=3","gravatar_id":"","url":"https://api.github.com/users/elikohen","html_url":"https://github.com/elikohen","followers_url":"https://api.github.com/users/elikohen/followers","following_url":"https://api.github.com/users/elikohen/following{/other_user}","gists_url":"https://api.github.com/users/elikohen/gists{/gist_id}","starred_url":"https://api.github.com/users/elikohen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elikohen/subscriptions","organizations_url":"https://api.github.com/users/elikohen/orgs","repos_url":"https://api.github.com/users/elikohen/repos","events_url":"https://api.github.com/users/elikohen/events{/privacy}","received_events_url":"https://api.github.com/users/elikohen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/realm/realm-java/labels/Pending","name":"Pending","color":"ededed"}],"state":"closed","locked":false,"assignee":{"login":"beeender","id":449296,"avatar_url":"https://avatars.githubusercontent.com/u/449296?v=3","gravatar_id":"","url":"https://api.github.com/users/beeender","html_url":"https://github.com/beeender","followers_url":"https://api.github.com/users/beeender/followers","following_url":"https://api.github.com/users/beeender/following{/other_user}","gists_url":"https://api.github.com/users/beeender/gists{/gist_id}","starred_url":"https://api.github.com/users/beeender/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beeender/subscriptions","organizations_url":"https://api.github.com/users/beeender/orgs","repos_url":"https://api.github.com/users/beeender/repos","events_url":"https://api.github.com/users/beeender/events{/privacy}","received_events_url":"https://api.github.com/users/beeender/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2015-07-06T10:16:00Z","updated_at":"2015-07-06T11:39:16Z","closed_at":"2015-07-06T11:39:16Z","body":"Hello. \r\nWe're getting a random crash on Realm.java \r\n\r\nHere's the stacktrace:\r\n```\r\njava.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.concurrent.atomic.AtomicInteger.decrementAndGet()' on a null object reference\r\n       at io.realm.Realm.close(Realm.java:243)\r\n       at com.ztory.datastore.news.NewsDataStore.doQueryObject(NewsDataStore.java:88)\r\n       at com.ztory.datastore.news.NewsDataStore.doQuery(NewsDataStore.java:68)\r\n       at com.ztory.datastore.news.NewsDataStore.dsOperation(NewsDataStore.java:34)\r\n       at com.ztory.support.datastore.StDataStore.execOperation(StDataStore.java:242)\r\n       at com.ztory.support.datastore.StDataStore.access$000(StDataStore.java:17)\r\n       at com.ztory.support.datastore.StDataStore$3.r(StDataStore.java:158)\r\n       at com.ztory.support.app.beacon.AppBeacon$5.r(AppBeacon.java:407)\r\n       at com.ztory.support.app.beacon.AppBeacon.sendEvent(AppBeacon.java:427)\r\n       at com.ztory.support.app.beacon.AppBeacon.sendEvent(AppBeacon.java:333)\r\n       at com.ztory.support.datastore.StDataStore.eventSend(StDataStore.java:51)\r\n       at com.ztory.support.datastore.StDataStore.eventSend(StDataStore.java:26)\r\n       at com.ztory.datastore.activities.ActivityPojo.getNewsData(ActivityPojo.java:479)\r\n       at com.ztory.datastore.activities.ActivityPojo.access$1100(ActivityPojo.java:39)\r\n       at com.ztory.datastore.activities.ActivityPojo$8.r(ActivityPojo.java:369)\r\n       at com.ztory.support.app.async.AppAsyncStack$1.run(AppAsyncStack.java:78)\r\n       at java.lang.Thread.run(Thread.java:818)\r\n```\r\n\r\nAnd here's the call we're performing:\r\n```\r\n        Realm realm = Realm.getDefaultInstance();\r\n        NewsRealm result = realm.where(NewsRealm.class).equalTo(\"id\", objectId).findFirst();\r\n        if (result != null) {\r\n            //NewsPojo is a simple data object where we copy all the values from the realm object\r\n            objects.add(new NewsPojo(result)); \r\n        }\r\n        realm.close();\r\n```\r\nThe crash is happening on `realm.close();`"},"comment":{"url":"https://api.github.com/repos/realm/realm-java/issues/comments/118828298","html_url":"https://github.com/realm/realm-java/issues/1266#issuecomment-118828298","issue_url":"https://api.github.com/repos/realm/realm-java/issues/1266","id":118828298,"user":{"login":"kneth","id":1225363,"avatar_url":"https://avatars.githubusercontent.com/u/1225363?v=3","gravatar_id":"","url":"https://api.github.com/users/kneth","html_url":"https://github.com/kneth","followers_url":"https://api.github.com/users/kneth/followers","following_url":"https://api.github.com/users/kneth/following{/other_user}","gists_url":"https://api.github.com/users/kneth/gists{/gist_id}","starred_url":"https://api.github.com/users/kneth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kneth/subscriptions","organizations_url":"https://api.github.com/users/kneth/orgs","repos_url":"https://api.github.com/users/kneth/repos","events_url":"https://api.github.com/users/kneth/events{/privacy}","received_events_url":"https://api.github.com/users/kneth/received_events","type":"User","site_admin":false},"created_at":"2015-07-06T11:39:16Z","updated_at":"2015-07-06T11:39:16Z","body":"I'll close the issue as you cannot reproduce it. If you see the issue again, don't hesitate to open a new issue."}}