We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents fc627cf + 5d9c6f0 commit 2192cc4Copy full SHA for 2192cc4
Assets/HoloToolkit/Sharing/Scripts/Utilities/DirectPairing.cs
@@ -63,7 +63,10 @@ void Start()
63
64
void OnDestroy()
65
{
66
- if (this.sharingMgr != null)
+ // SharingStage's OnDestroy() might execute first in the script order. Therefore we should check if
67
+ // SharingStage.Instance still exists. Without the instance check, the execution of GetPairingManager
68
+ // on a disposed sharing manager will crash the Unity Editor and application.
69
+ if (SharingStage.Instance != null && this.sharingMgr != null)
70
71
PairingManager pairingMgr = sharingMgr.GetPairingManager();
72
pairingMgr.CancelPairing(); // Safe to call, even if no pairing is in progress. Will not cause a disconnect
0 commit comments