mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
[fix] fix crash when transmission id does not exist
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
#include "rd_log.h"
|
||||
#include "render.h"
|
||||
|
||||
int Render::ConnectionStatusWindow(
|
||||
bool Render::ConnectionStatusWindow(
|
||||
std::shared_ptr<SubStreamWindowProperties> &props) {
|
||||
if (show_connection_status_window_) {
|
||||
const ImGuiViewport *viewport = ImGui::GetMainViewport();
|
||||
@@ -160,7 +160,7 @@ int Render::ConnectionStatusWindow(
|
||||
show_connection_status_window_ = false;
|
||||
re_enter_remote_id_ = true;
|
||||
DestroyPeer(&props->peer_);
|
||||
client_properties_.erase(props->remote_id_);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,5 +175,5 @@ int Render::ConnectionStatusWindow(
|
||||
ImGui::End();
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
@@ -29,8 +29,13 @@ int Render::MainWindow() {
|
||||
RecentConnectionsWindow();
|
||||
StatusBar();
|
||||
|
||||
for (auto& it : client_properties_) {
|
||||
ConnectionStatusWindow(it.second);
|
||||
for (auto it = client_properties_.begin(); it != client_properties_.end();) {
|
||||
auto& props = it->second;
|
||||
if (ConnectionStatusWindow(props)) {
|
||||
it = client_properties_.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -151,7 +151,8 @@ class Render {
|
||||
int ControlBar(std::shared_ptr<SubStreamWindowProperties> &props);
|
||||
int AboutWindow();
|
||||
int StatusBar();
|
||||
int ConnectionStatusWindow(std::shared_ptr<SubStreamWindowProperties> &props);
|
||||
bool ConnectionStatusWindow(
|
||||
std::shared_ptr<SubStreamWindowProperties> &props);
|
||||
int ShowRecentConnections();
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user