summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2020-01-03 19:50:48 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2020-01-03 19:50:48 +0100
commitbd8e139ccc04590d11b2347e3987a38d6f732c27 (patch)
tree7b3c37eb504317d2bc5401604621a84a03b3eaaf
parent6983019cab6acc39d3e4157f7e03aafadb2291df (diff)
downloadfork-godot-webrtc-native-bd8e139ccc04590d11b2347e3987a38d6f732c27.tar.gz
fork-godot-webrtc-native-bd8e139ccc04590d11b2347e3987a38d6f732c27.tar.bz2
fork-godot-webrtc-native-bd8e139ccc04590d11b2347e3987a38d6f732c27.zip
Fix crash when closing an invalid peerconnection.
-rw-r--r--src/WebRTCLibPeerConnection.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/WebRTCLibPeerConnection.cpp b/src/WebRTCLibPeerConnection.cpp
index a922f1b..6e81a7c 100644
--- a/src/WebRTCLibPeerConnection.cpp
+++ b/src/WebRTCLibPeerConnection.cpp
@@ -172,7 +172,10 @@ godot_error WebRTCLibPeerConnection::poll() {
}
void WebRTCLibPeerConnection::close() {
- peer_connection->Close();
+ if (peer_connection.get() != nullptr) {
+ peer_connection->Close();
+ }
+ peer_connection = nullptr;
while(!signal_queue.empty()) {
signal_queue.pop();
}