Skip to content

Fixed an issue with WebRTC signaling example server parsing #1214

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 3 additions & 1 deletion networking/webrtc_signaling/server/ws_webrtc_server.gd
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ func _parse_msg(peer: Peer) -> bool:
if typeof(parsed) != TYPE_DICTIONARY or not parsed.has("type") or not parsed.has("id") or \
typeof(parsed.get("data")) != TYPE_STRING:
return false
if not str(parsed.type).is_valid_int() or not str(parsed.id).is_valid_int():
if not typeof(parsed.type) == TYPE_FLOAT and int(parsed.type) == parsed.type:
return false
if not typeof(parsed.id == TYPE_FLOAT) and int(parsed.id) == parsed.id:
Comment on lines +210 to +212
Copy link
Member

Choose a reason for hiding this comment

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

The parentheses for typeof() don't end at the same position in both checks, is that intended?

Copy link
Member

Choose a reason for hiding this comment

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

This would check the type of bool, and then check if that is 0 or not, that doesn't seem right

return false

var msg := {
Expand Down