A room.attendants left message with no id crashes some other clients. :/

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4114 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-01-11 01:55:23 +00:00
parent 987b2d539a
commit 3c687dc780

View File

@ -1012,30 +1012,30 @@ static void _tf_ssb_rpc_connections_changed_callback(tf_ssb_t* ssb, tf_ssb_chang
{
tf_ssb_remove_blob_want_added_callback(ssb, _tf_ssb_rpc_blob_wants_added_callback, connection);
JSValue left = JS_NewObject(context);
JS_SetPropertyStr(context, left, "type", JS_NewString(context, "left"));
char id[k_id_base64_len] = "";
if (tf_ssb_connection_get_id(connection, id, sizeof(id)))
{
JSValue left = JS_NewObject(context);
JS_SetPropertyStr(context, left, "type", JS_NewString(context, "left"));
JS_SetPropertyStr(context, left, "id", JS_NewString(context, id));
}
tf_ssb_connection_t* connections[1024];
int count = tf_ssb_get_connections(ssb, connections, _countof(connections));
for (int i = 0; i < count; i++)
{
if (tf_ssb_connection_is_attendant(connections[i]))
tf_ssb_connection_t* connections[1024];
int count = tf_ssb_get_connections(ssb, connections, _countof(connections));
for (int i = 0; i < count; i++)
{
tf_ssb_connection_rpc_send_json(
connections[i],
k_ssb_rpc_flag_stream,
-tf_ssb_connection_get_attendant_request_number(connections[i]),
left,
NULL,
NULL,
NULL);
if (tf_ssb_connection_is_attendant(connections[i]))
{
tf_ssb_connection_rpc_send_json(
connections[i],
k_ssb_rpc_flag_stream,
-tf_ssb_connection_get_attendant_request_number(connections[i]),
left,
NULL,
NULL,
NULL);
}
}
JS_FreeValue(context, left);
}
JS_FreeValue(context, left);
}
}