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

JSONRPC: Convert ids to int if they are int by value #100950

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
5 changes: 5 additions & 0 deletions modules/jsonrpc/jsonrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ Variant JSONRPC::process_action(const Variant &p_action, bool p_process_arr_elem
Variant id;
if (dict.has("id")) {
id = dict["id"];

// Account for implementations that discern between int and float on the json serialization level, by using an int if there is a .0 fraction. See #100914
if (id.get_type() == Variant::FLOAT && id.operator float() == (float)(id.operator int())) {
id = id.operator int();
}
}

if (object == nullptr || !object->has_method(method)) {
Expand Down