Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json::serialization: fix reading attributes from non-objects #2295

Merged
merged 1 commit into from
Aug 26, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/json/serialization.nit
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,14 @@ class JsonDeserializer

redef fun deserialize_attribute(name, static_type)
do
assert not path.is_empty # This is an internal error, abort
if path.is_empty then
# The was a parsing error or the root is not an object
if not root isa Error then
errors.add new Error("Deserialization Error: parsed JSON value is not an object.")
end
return null
end

var current = path.last

if not current.keys.has(name) then
Expand Down