{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/JLD.jl/issues/47","labels_url":"https://api.github.com/repos/JuliaLang/JLD.jl/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/JLD.jl/issues/47/comments","events_url":"https://api.github.com/repos/JuliaLang/JLD.jl/issues/47/events","html_url":"https://github.com/JuliaLang/JLD.jl/issues/47","id":120575911,"number":47,"title":"Nullables can cause UndefRefErrors","user":{"login":"jrevels","id":3277443,"avatar_url":"https://avatars.githubusercontent.com/u/3277443?v=3","gravatar_id":"","url":"https://api.github.com/users/jrevels","html_url":"https://github.com/jrevels","followers_url":"https://api.github.com/users/jrevels/followers","following_url":"https://api.github.com/users/jrevels/following{/other_user}","gists_url":"https://api.github.com/users/jrevels/gists{/gist_id}","starred_url":"https://api.github.com/users/jrevels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrevels/subscriptions","organizations_url":"https://api.github.com/users/jrevels/orgs","repos_url":"https://api.github.com/users/jrevels/repos","events_url":"https://api.github.com/users/jrevels/events{/privacy}","received_events_url":"https://api.github.com/users/jrevels/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-05T17:51:24Z","updated_at":"2015-12-05T23:41:38Z","closed_at":null,"body":"```julia\r\njulia> JLD.save(\"test.jld\", \"x\", Nullable{UTF8String}())\r\nERROR: UndefRefError: access to undefined reference\r\n in write_compound at /Users/jarrettrevels/.julia/v0.4/JLD/src/JLD.jl:683\r\n in write at /Users/jarrettrevels/.julia/v0.4/JLD/src/JLD.jl:504\r\n in anonymous at /Users/jarrettrevels/.julia/v0.4/JLD/src/JLD.jl:1165\r\n in jldopen at /Users/jarrettrevels/.julia/v0.4/JLD/src/JLD.jl:240\r\n in save at /Users/jarrettrevels/.julia/v0.4/JLD/src/JLD.jl:1163\r\n in save at /Users/jarrettrevels/.julia/v0.4/FileIO/src/loadsave.jl:51\r\n```\r\n\r\nThis is because the `value` of the Nullable is `#undef`:\r\n\r\n```julia\r\njulia> dump(Nullable{UTF8String}())\r\nNullable{UTF8String}\r\n  isnull: Bool true\r\n  value: #undef\r\n```\r\n\r\nNote, then, that types which initialize with values are unaffected, e.g. numeric primitives:\r\n\r\n```julia\r\njulia> dump(Nullable{Float64}())\r\nNullable{Float64}\r\n  isnull: Bool true\r\n  value: Float64 2.151511976e-314\r\n\r\njulia> JLD.save(\"test.jld\", \"x\", Nullable{Float64}()) # works fine\r\n```"},"comment":{"url":"https://api.github.com/repos/JuliaLang/JLD.jl/issues/comments/162257433","html_url":"https://github.com/JuliaLang/JLD.jl/issues/47#issuecomment-162257433","issue_url":"https://api.github.com/repos/JuliaLang/JLD.jl/issues/47","id":162257433,"user":{"login":"simonster","id":470884,"avatar_url":"https://avatars.githubusercontent.com/u/470884?v=3","gravatar_id":"","url":"https://api.github.com/users/simonster","html_url":"https://github.com/simonster","followers_url":"https://api.github.com/users/simonster/followers","following_url":"https://api.github.com/users/simonster/following{/other_user}","gists_url":"https://api.github.com/users/simonster/gists{/gist_id}","starred_url":"https://api.github.com/users/simonster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonster/subscriptions","organizations_url":"https://api.github.com/users/simonster/orgs","repos_url":"https://api.github.com/users/simonster/repos","events_url":"https://api.github.com/users/simonster/events{/privacy}","received_events_url":"https://api.github.com/users/simonster/received_events","type":"User","site_admin":false},"created_at":"2015-12-05T23:41:38Z","updated_at":"2015-12-05T23:41:38Z","body":"This is most likely specific to undefined string fields. It doesn't happen with arbitrary non-pointerfree types. I'm not sure whether libhdf5 would let us specify an undefined string field using a null pointer, but we could try. JLD2 handles this properly, but I've been swamped with work recently and haven't been able to finish it (which basically means implementing compression; everything else works)."}}