summaryrefslogtreecommitdiffstats
path: root/modules/multiplayer
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2024-09-02 10:55:43 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-09-17 08:57:42 +0200
commit1a5ac1fd5941b8961fb7395d5e3c2c6764d553a4 (patch)
tree0a54ac853b57e1546e7d8c4ea9bc460a2b56030d /modules/multiplayer
parente72e42fe9be186d1b42cedcb2557d02104ff0967 (diff)
downloadredot-engine-1a5ac1fd5941b8961fb7395d5e3c2c6764d553a4.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. (cherry picked from commit 042b264c5591b430beca0c0acbdeec8c3d660525)
Diffstat (limited to 'modules/multiplayer')
-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;
}
}