{"action":"created","issue":{"url":"https://api.github.com/repos/dancannon/gorethink/issues/226","labels_url":"https://api.github.com/repos/dancannon/gorethink/issues/226/labels{/name}","comments_url":"https://api.github.com/repos/dancannon/gorethink/issues/226/comments","events_url":"https://api.github.com/repos/dancannon/gorethink/issues/226/events","html_url":"https://github.com/dancannon/gorethink/issues/226","id":105641016,"number":226,"title":"r.Cursor.Next() no longer sets pointer to nil on document not found","user":{"login":"ftKnox","id":11303823,"avatar_url":"https://avatars.githubusercontent.com/u/11303823?v=3","gravatar_id":"","url":"https://api.github.com/users/ftKnox","html_url":"https://github.com/ftKnox","followers_url":"https://api.github.com/users/ftKnox/followers","following_url":"https://api.github.com/users/ftKnox/following{/other_user}","gists_url":"https://api.github.com/users/ftKnox/gists{/gist_id}","starred_url":"https://api.github.com/users/ftKnox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ftKnox/subscriptions","organizations_url":"https://api.github.com/users/ftKnox/orgs","repos_url":"https://api.github.com/users/ftKnox/repos","events_url":"https://api.github.com/users/ftKnox/events{/privacy}","received_events_url":"https://api.github.com/users/ftKnox/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dancannon/gorethink/labels/p:medium","name":"p:medium","color":"eb6420"},{"url":"https://api.github.com/repos/dancannon/gorethink/labels/s:in-progress","name":"s:in-progress","color":"DCDCDC"},{"url":"https://api.github.com/repos/dancannon/gorethink/labels/t:bug","name":"t:bug","color":"FF7575"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-09T17:02:51Z","updated_at":"2015-09-20T19:14:59Z","closed_at":null,"body":"Documents that don't exist no longer set the pointer to nil when using r.Cursor.Next(). Seems to come from this commit c52349e8e587dbbffe482e9404420d310b2015a7 in func decode()\r\n\r\nChanging decode from\r\n```\r\n func decode(dv, sv reflect.Value) {\r\n       if dv.IsValid() {\r\n               dv = indirect(dv, false)\r\n               dv.Set(reflect.Zero(dv.Type()))\r\n       }\r\n\r\n        valueDecoder(dv, sv)(dv, sv)\r\n }\r\n```\r\n\r\nback to\r\n```\r\n func decode(dv, sv reflect.Value) {\r\n    valueDecoder(dv, sv)(dv, sv)\r\n }\r\n```\r\n\r\nrestores previous behavior. I don't know the codebase well enough, to determine if this breaks other things.\r\n\r\n\r\ntest case (shortened for brevity) -- Also note that using cur.One(&doc) works as expected and returns nil\r\n\r\n ```\r\ntype doc struct {\r\n  id string\r\n}\r\n\r\ncur, err := r.Table(\"test\").Get(NonExistingDocId).Run(sess)\r\nif err != nil {\r\n  panic(fmt.Sprintf(\"Could not check for existing document [ERR:%s]\", err.Error()))\r\n}\r\ncur.Next(&doc)\r\nif doc == nil {\r\n  fmt.Printf(\"Document not found!\\n\")\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/dancannon/gorethink/issues/comments/141821989","html_url":"https://github.com/dancannon/gorethink/issues/226#issuecomment-141821989","issue_url":"https://api.github.com/repos/dancannon/gorethink/issues/226","id":141821989,"user":{"login":"dancannon","id":414768,"avatar_url":"https://avatars.githubusercontent.com/u/414768?v=3","gravatar_id":"","url":"https://api.github.com/users/dancannon","html_url":"https://github.com/dancannon","followers_url":"https://api.github.com/users/dancannon/followers","following_url":"https://api.github.com/users/dancannon/following{/other_user}","gists_url":"https://api.github.com/users/dancannon/gists{/gist_id}","starred_url":"https://api.github.com/users/dancannon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dancannon/subscriptions","organizations_url":"https://api.github.com/users/dancannon/orgs","repos_url":"https://api.github.com/users/dancannon/repos","events_url":"https://api.github.com/users/dancannon/events{/privacy}","received_events_url":"https://api.github.com/users/dancannon/received_events","type":"User","site_admin":false},"created_at":"2015-09-20T19:14:59Z","updated_at":"2015-09-20T19:14:59Z","body":"I have just pushed an update to develop which should fix this issue, I hope to have it pushed to master within a couple of days."}}