wit-ai / wit-unity

Wit-Unity is a Unity C# wrapper around the the Wit.ai rest APIs and is a core component of Voice SDK.
Other
80 stars 20 forks source link

NullReferenceException when starting recording if there are no connected microphones #64

Closed jesperlundqvist closed 2 years ago

jesperlundqvist commented 2 years ago

We've discovered a bug when starting recording on a device with no connected microphones. When starting the recording with Wit.Activate(), we get a NullReferenceException. See the stack trace below for details.

NullReferenceException: Object reference not set to an instance of an object
Facebook.WitAi.Lib.Mic.StartRecording (System.Int32 sampleLen) (at Assets/Oculus/Voice/Lib/Wit.ai/Scripts/Runtime/Lib/Mic.cs:229)
Facebook.WitAi.Wit.Activate (Facebook.WitAi.Configuration.WitRequestOptions requestOptions) (at Assets/Oculus/Voice/Lib/Wit.ai/Scripts/Runtime/Wit.cs:334)
Facebook.WitAi.Wit.Activate () (at Assets/Oculus/Voice/Lib/Wit.ai/Scripts/Runtime/Wit.cs:305)

Note that this is using the Oculus Voice SDK.

This can be easily reproduced on Windows by disabling every sound input device in the sound settings.

ramh commented 2 years ago

Thank you so much for reporting the issue. We will take a look at this soon.

yolanother commented 2 years ago

@jesperlundqvist a fix for this has been checked in and is accessible via Wit-Unity v0.0.24. It will likely land in v37 of the Voice SDK.