Skip to content

Commit fa11c05

Browse files
committed
fix: silent startup crash on missing native dependency
Display an error dialog when a native library cannot be loaded.
1 parent 4e6017b commit fa11c05

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

AudioAlign/MainWindow.xaml.cs

+19-6
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,25 @@ public partial class MainWindow : Window
5555

5656
public MainWindow()
5757
{
58-
// Use PFFFT as FFT implementation
59-
FFTFactory.Factory = new Aurio.PFFFT.FFTFactory();
60-
// Use Soxr as resampler implementation
61-
ResamplerFactory.Factory = new Aurio.Soxr.ResamplerFactory();
62-
// Use FFmpeg for file reading/decoding
63-
AudioStreamFactory.AddFactory(new FFmpegAudioStreamFactory());
58+
try
59+
{
60+
// Use PFFFT as FFT implementation
61+
FFTFactory.Factory = new Aurio.PFFFT.FFTFactory();
62+
// Use Soxr as resampler implementation
63+
ResamplerFactory.Factory = new Aurio.Soxr.ResamplerFactory();
64+
// Use FFmpeg for file reading/decoding
65+
AudioStreamFactory.AddFactory(new FFmpegAudioStreamFactory());
66+
}
67+
catch (Exception e)
68+
{
69+
MessageBox.Show(
70+
e.Message,
71+
"AudioAlign startup error",
72+
MessageBoxButton.OK,
73+
MessageBoxImage.Error,
74+
MessageBoxResult.Yes
75+
);
76+
}
6477

6578
recentProjects = new RecentProjects();
6679

0 commit comments

Comments
 (0)