Skip to content

Conversation

@yuto-trd
Copy link
Member

@yuto-trd yuto-trd commented Nov 9, 2025

SoundSourceが設定されていない状態で再生すると例外が発生するのを修正


Note

Handle null sound source in Sound.Compose by clearing the AudioContext and returning instead of throwing an exception.

Written by Cursor Bugbot for commit 18fa5dd. This will update automatically on new commits. Configure here.

Copilot AI review requested due to automatic review settings November 9, 2025 07:49
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an exception that occurs when attempting to play audio without a configured SoundSource. Instead of throwing an exception, the code now clears the audio context and returns early.

Key Changes:

  • Replaced exception throwing with a safe early-return pattern when SoundSource is null
  • Added context clearing to ensure clean state when no sound source is available

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

var soundSource = GetSoundSource();
if (soundSource == null) throw new Exception("Sound source is not available");
if (soundSource == null)
{
Copy link

Copilot AI Nov 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding a comment explaining why the context is cleared when the sound source is null, as this behavior change from throwing an exception may not be immediately obvious to maintainers.

Suggested change
{
{
// If there is no sound source, clear the context to ensure no audio is produced.
// This is intentional: previously this may have thrown an exception, but now we
// explicitly clear the context to avoid errors and undefined behavior.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2025

No TODO comments were found.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2025

Code Coverage

Package Line Rate Branch Rate Complexity Health
Beutl.Operators 4% 0% 58
Beutl.Core 31% 28% 3058
Beutl.Engine 31% 28% 9527
Beutl.Threading 100% 94% 118
Beutl.Utilities 73% 67% 360
Beutl.Configuration 40% 19% 283
Beutl.Extensibility 2% 0% 106
Beutl.ProjectSystem 12% 6% 2075
Beutl.Language 0% 0% 636
Summary 28% (10976 / 38968) 26% (2934 / 11249) 16221

Minimum allowed line rate is 0%

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.

2 participants