Skip to content

Commit c1be0c8

Browse files
committed
fix: deleting probes null pointer
2 parents a4e2ce5 + cf84b80 commit c1be0c8

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

Assets/Scripts/TrajectoryPlanner/Probes/ProbeManager.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,17 +209,21 @@ private void Start()
209209
/// </summary>
210210
public void Destroy()
211211
{
212-
// Delete this gameObject
213-
foreach (ProbeUIManager puimanager in _probeUIManagers)
214-
puimanager.Destroy();
215212

216213
ProbeProperties.ReturnColor(Color);
217214

218215
ColliderManager.RemoveProbeColliderInstances(_probeColliders);
219216

220217
// Force disable Ephys Link
221-
CommunicationManager.Instance.UnregisterManipulator(ManipulatorBehaviorController.ManipulatorID);
222-
IsEphysLinkControlled = false;
218+
if (IsEphysLinkControlled)
219+
{
220+
CommunicationManager.Instance.UnregisterManipulator(ManipulatorBehaviorController.ManipulatorID);
221+
IsEphysLinkControlled = false;
222+
}
223+
224+
// Delete this gameObject
225+
foreach (ProbeUIManager puimanager in _probeUIManagers)
226+
puimanager.Destroy();
223227
}
224228

225229
private void OnDestroy()

0 commit comments

Comments
 (0)