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

Parse Vector256 from JSON (eg. Indexes) properly #358

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions src/ripple_data/protocol/STParsedJSON.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,10 +428,10 @@ bool STParsedJSON::parse (std::string const& json_name,
STVector256* tail (dynamic_cast <STVector256*> (&data.back ()));
assert (tail);

for (Json::UInt i = 0; !json.isValidIndex (i); ++i)
for (Json::UInt i = 0; value.isValidIndex (i); ++i)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ouch! dreadful!

Could we get perhaps a unit test for this, so it doesn't happen again?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that would be ideal, I just hit edit in the brower, as reporting things on JIRA is such a PITA

I guess I can try knock up a test, if no one else gets to it

{
uint256 s;
s.SetHex (json[i].asString ());
s.SetHex (value[i].asString ());
tail->addValue (s);
}
}
Expand Down