summaryrefslogtreecommitdiff
path: root/src/WebRTCLibPeerConnection.cpp
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2020-01-13 18:18:20 +0100
committerGitHub <noreply@github.com>2020-01-13 18:18:20 +0100
commit5f9e74f2fb2658ae15e8bc5b17be208f39d32c3f (patch)
tree7b3c37eb504317d2bc5401604621a84a03b3eaaf /src/WebRTCLibPeerConnection.cpp
parent61e45cb083a2879bed238f3052f7c12bd230da16 (diff)
parentbd8e139ccc04590d11b2347e3987a38d6f732c27 (diff)
downloadfork-godot-webrtc-native-5f9e74f2fb2658ae15e8bc5b17be208f39d32c3f.tar.gz
fork-godot-webrtc-native-5f9e74f2fb2658ae15e8bc5b17be208f39d32c3f.tar.bz2
fork-godot-webrtc-native-5f9e74f2fb2658ae15e8bc5b17be208f39d32c3f.zip
Merge pull request #11 from Faless/fix/close_crash
Fix crash when closing an invalid peerconnection.
Diffstat (limited to 'src/WebRTCLibPeerConnection.cpp')
-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();
}