Skip to content

Fix mic access errors#718

Open
lukechatton wants to merge 1 commit intomainfrom
fix/mic-access-error
Open

Fix mic access errors#718
lukechatton wants to merge 1 commit intomainfrom
fix/mic-access-error

Conversation

@lukechatton
Copy link
Member

@lukechatton lukechatton commented Feb 11, 2026

Summary

  • prevent voice mic startup from crashing when the selected mic device cannot be resolved
  • add defensive null/readiness checks before starting UniVoice recording
  • remove duplicate mic-start trigger in main-menu microphone toggle flow

Problem

Users could hit a System.NullReferenceException in Bridge.StartMicRecording when currentDevice was null/stale (for example after device list/name mismatches like Audio Out).
The mic toggle path in settings also triggered recording twice, causing duplicate start attempts/log spam.

Root Cause

  • SetMicDeviceIndex relied on direct name matching against UniMic devices; when no match was found, currentDevice remained null.
  • StartMicRecording assumed currentDevice was valid.
  • UI toggle path called both PickMicAndStartRecording() and SetMicrophoneEnabled(true) (which already calls PickMicAndStartRecording()).

Changes

airship

  • Bridge.cs
    • harden mic resolution in SetMicDeviceIndex:
      • exact match, then case-insensitive match
      • fallback to first valid available mic
    • harden StartMicRecording:
      • recover if currentDevice is null/stale
      • log warning and return if no valid mic exists
    • add helper methods:
      • ResolveMicDeviceByName
      • ResolveFirstMicDevice
  • AirshipUniVoice.cs
    • add guard clauses in StartRecording(Mic.Device mic):
      • return with error log if mic == null
      • return with error log if ClientSession == null

airship-testbed (#718)

  • MicrophoneSettingsPage.ts
    • remove redundant clientSettings.PickMicAndStartRecording() call from voice-toggle handler
    • rely on clientSettings.SetMicrophoneEnabled(true) to perform single start path

Behavior After

  • no exception when selected mic cannot be resolved; code now falls back safely or exits with warning
  • mic toggle performs one start attempt instead of two
  • clearer logs for invalid device/session states

Assumptions

  • fallbacking to first valid input device is preferable to failing hard
  • if no valid microphone device is present, recording should not start and should fail gracefully

Impacted Repos

  • airship
  • airship-testbed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant