@@ -59,6 +59,12 @@ public void OnApplicationQuit()
5959 public void Stop ( )
6060 {
6161 iface = null ;
62+ poseMatrixCallbacks = null ;
63+ poseCallbacks = null ;
64+ positionCallbacks = null ;
65+ orientationCallbacks = null ;
66+ buttonCallbacks = null ;
67+ analogCallbacks = null ;
6268 }
6369
6470 #region Generated RegisterCallback overloads and associated data
@@ -185,7 +191,10 @@ private void PoseCb(System.IntPtr userdata, ref OSVR.ClientKit.TimeValue timesta
185191 {
186192 Vector3 position = Math . ConvertPosition ( report . pose . translation ) ;
187193 Quaternion rotation = Math . ConvertOrientation ( report . pose . rotation ) ;
188- poseCallbacks ( path , position , rotation ) ;
194+ if ( null != poseCallbacks )
195+ {
196+ poseCallbacks ( path , position , rotation ) ;
197+ }
189198 }
190199
191200 /// <summary>
@@ -197,7 +206,10 @@ private void PoseCb(System.IntPtr userdata, ref OSVR.ClientKit.TimeValue timesta
197206 private void PoseMatrixCb ( System . IntPtr userdata , ref OSVR . ClientKit . TimeValue timestamp , ref OSVR . ClientKit . PoseReport report )
198207 {
199208 Matrix4x4 matPose = Math . ConvertPose ( report . pose ) ;
200- poseMatrixCallbacks ( path , matPose ) ;
209+ if ( null != poseMatrixCallbacks )
210+ {
211+ poseMatrixCallbacks ( path , matPose ) ;
212+ }
201213 }
202214
203215 /// <summary>
@@ -209,7 +221,10 @@ private void PoseMatrixCb(System.IntPtr userdata, ref OSVR.ClientKit.TimeValue t
209221 private void PositionCb ( System . IntPtr userdata , ref OSVR . ClientKit . TimeValue timestamp , ref OSVR . ClientKit . PositionReport report )
210222 {
211223 Vector3 position = Math . ConvertPosition ( report . xyz ) ;
212- positionCallbacks ( path , position ) ;
224+ if ( null != positionCallbacks )
225+ {
226+ positionCallbacks ( path , position ) ;
227+ }
213228 }
214229
215230 /// <summary>
@@ -221,7 +236,10 @@ private void PositionCb(System.IntPtr userdata, ref OSVR.ClientKit.TimeValue tim
221236 private void OrientationCb ( System . IntPtr userdata , ref OSVR . ClientKit . TimeValue timestamp , ref OSVR . ClientKit . OrientationReport report )
222237 {
223238 Quaternion rotation = Math . ConvertOrientation ( report . rotation ) ;
224- orientationCallbacks ( path , rotation ) ;
239+ if ( null != orientationCallbacks )
240+ {
241+ orientationCallbacks ( path , rotation ) ;
242+ }
225243 }
226244
227245 /// <summary>
@@ -248,7 +266,10 @@ private void ButtonCb(System.IntPtr userdata, ref OSVR.ClientKit.TimeValue times
248266 private void AnalogCb ( System . IntPtr userdata , ref OSVR . ClientKit . TimeValue timestamp , ref OSVR . ClientKit . AnalogReport report )
249267 {
250268 float val = ( float ) report . state ;
251- analogCallbacks ( path , val ) ;
269+ if ( null != analogCallbacks )
270+ {
271+ analogCallbacks ( path , val ) ;
272+ }
252273 }
253274 #endregion
254275
0 commit comments