Fixing null-errors with server and camera.

parent 9bd3d728
......@@ -30,7 +30,14 @@ public class FFmpegCapture : MonoBehaviour
public string StopCapture()
{
cameraCapture.enabled = false;
return cameraCapture.videoPath;
if (cameraCapture == null)
{
return "No video capture found.";
}
else
{
cameraCapture.enabled = false;
return cameraCapture.videoPath;
}
}
}
......@@ -75,6 +75,7 @@ public class SceneController : MonoBehaviour
SceneManager.sceneLoaded -= OnSceneLoaded;
if (captureVideo)
{
videoCapture = Camera.main.GetComponent<FFmpegCapture>();
videoCapture.StartCapture();
}
if (this.instruction != null)
......
......@@ -70,7 +70,11 @@ public class ZMQServer : MonoBehaviour
void OnDestroy()
{
server.Close();
if (server != null)
{
server.Close();
server = null;
}
}
public IEnumerator ReplyToRequest(string response)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment