{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-java/issues/1051","labels_url":"https://api.github.com/repos/realm/realm-java/issues/1051/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-java/issues/1051/comments","events_url":"https://api.github.com/repos/realm/realm-java/issues/1051/events","html_url":"https://github.com/realm/realm-java/issues/1051","id":69598614,"number":1051,"title":"copyToRealmOrUpdate SIGSEGV","user":{"login":"tmeunier","id":10448238,"avatar_url":"https://avatars.githubusercontent.com/u/10448238?v=3","gravatar_id":"","url":"https://api.github.com/users/tmeunier","html_url":"https://github.com/tmeunier","followers_url":"https://api.github.com/users/tmeunier/followers","following_url":"https://api.github.com/users/tmeunier/following{/other_user}","gists_url":"https://api.github.com/users/tmeunier/gists{/gist_id}","starred_url":"https://api.github.com/users/tmeunier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmeunier/subscriptions","organizations_url":"https://api.github.com/users/tmeunier/orgs","repos_url":"https://api.github.com/users/tmeunier/repos","events_url":"https://api.github.com/users/tmeunier/events{/privacy}","received_events_url":"https://api.github.com/users/tmeunier/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-20T14:23:38Z","updated_at":"2015-04-21T02:10:12Z","closed_at":null,"body":"Hi,\r\n\r\nFollowing an update in my code, I randomly found a native crash (SIGSEGV 0x00000008) when using\r\n`copyToRealmOrUpdate` and an object with a declared `@PrimaryKey` which was not set before copy.\r\nUsing `Realm 0.80.1`\r\n\r\n\r\nTo reproduce with a testCase:\r\n\r\n```java\r\npublic class PrimaryKeyTest extends RealmObject {\r\n\r\n    @PrimaryKey\r\n    private String key;\r\n\r\n    public String getKey() {\r\n        return key;\r\n    }\r\n\r\n    public void setKey(String key) {\r\n        this.key = key;\r\n    }\r\n}\r\n```\r\n```java\r\npublic void testPrimKeyMissing() {\r\n        testRealm.beginTransaction();\r\n        try {\r\n            testRealm.copyToRealmOrUpdate(new PrimaryKeyTest());\r\n            testRealm.commitTransaction();\r\n        } catch (Exception e) {\r\n            // OK\r\n            testRealm.cancelTransaction();\r\n        }\r\n}\r\n```\r\n\r\n==> 'Instrumentation run failed due to 'Native crash''\r\n"},"comment":{"url":"https://api.github.com/repos/realm/realm-java/issues/comments/94612778","html_url":"https://github.com/realm/realm-java/issues/1051#issuecomment-94612778","issue_url":"https://api.github.com/repos/realm/realm-java/issues/1051","id":94612778,"user":{"login":"crysan","id":683015,"avatar_url":"https://avatars.githubusercontent.com/u/683015?v=3","gravatar_id":"","url":"https://api.github.com/users/crysan","html_url":"https://github.com/crysan","followers_url":"https://api.github.com/users/crysan/followers","following_url":"https://api.github.com/users/crysan/following{/other_user}","gists_url":"https://api.github.com/users/crysan/gists{/gist_id}","starred_url":"https://api.github.com/users/crysan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crysan/subscriptions","organizations_url":"https://api.github.com/users/crysan/orgs","repos_url":"https://api.github.com/users/crysan/repos","events_url":"https://api.github.com/users/crysan/events{/privacy}","received_events_url":"https://api.github.com/users/crysan/received_events","type":"User","site_admin":false},"created_at":"2015-04-21T02:10:12Z","updated_at":"2015-04-21T02:10:12Z","body":"Most likely if you do not specify copyToRealmOrUpdate PrimaryKey"}}