summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2024-09-02 10:55:43 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2024-09-02 13:29:38 +0200
commit042b264c5591b430beca0c0acbdeec8c3d660525 (patch)
tree3c6869e055373d4ac9baa6e2bae82ed5a193cf55 /modules
parent61598c5c88d95b96811d386cb20d714c35f4c6d7 (diff)
downloadredot-engine-042b264c5591b430beca0c0acbdeec8c3d660525.tar.gz
[MP] Fix division by zero in network profiler
The debugger reports synchronizers with empty state to the editor even if no data is being sent to other peers. The editor conditional to avoid division by zero was checking the wrong variable.
Diffstat (limited to 'modules')
-rw-r--r--modules/multiplayer/editor/editor_network_profiler.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/multiplayer/editor/editor_network_profiler.cpp b/modules/multiplayer/editor/editor_network_profiler.cpp
index d5d4b465d8..212fd1ef6b 100644
--- a/modules/multiplayer/editor/editor_network_profiler.cpp
+++ b/modules/multiplayer/editor/editor_network_profiler.cpp
@@ -227,10 +227,10 @@ void EditorNetworkProfiler::add_sync_frame_data(const SyncInfo &p_frame) {
sync_data[p_frame.synchronizer].outgoing_syncs += p_frame.outgoing_syncs;
}
SyncInfo &info = sync_data[p_frame.synchronizer];
- if (info.incoming_syncs) {
+ if (p_frame.incoming_syncs) {
info.incoming_size = p_frame.incoming_size / p_frame.incoming_syncs;
}
- if (info.outgoing_syncs) {
+ if (p_frame.outgoing_syncs) {
info.outgoing_size = p_frame.outgoing_size / p_frame.outgoing_syncs;
}
}