Skip to content

JSON::Object::stringify throw BadCastException #23

@hemduf

Description

@hemduf

Hello

this piece of code throws an exception BadCastException, the reason is that the types are not properly tested in the method "void Stringifier :: stringify (const Var & any, std :: ostream & out, unsigned int indent)".
it lacks the verfication following cases: any.type () == typeid (Object) && any.type () == typeid (Array)

int main(int argc, char** argv) {


    JSON::Object obj;

    JSON::Array array;
    JSON::Object obj2;

    obj.set("array", array);
    obj.set("obj2", obj2);

    obj.stringify(std::cout);

    return 0;
}

thank you for telling me if I'm wrong
Fabrizio

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions