Skip to content

Commit 77bbed8

Browse files
committed
Fixed a potential crash when importing presets.
1 parent c807896 commit 77bbed8

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

VidCoder/Model/PresetStorage.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -271,16 +271,19 @@ public static void ErrorCheckEncodingProfile(VCProfile profile)
271271
}
272272
}
273273

274-
foreach (var audioEncoding in profile.AudioEncodings)
274+
if (profile.AudioEncodings != null)
275275
{
276-
if (audioEncoding.Encoder == "fdk_aac")
276+
foreach (var audioEncoding in profile.AudioEncodings)
277277
{
278-
// Make sure this version of VidCoder recognizes the encoder
279-
HBAudioEncoder encoder = HandBrakeEncoderHelpers.GetAudioEncoder(audioEncoding.Encoder);
280-
if (encoder == null)
278+
if (audioEncoding.Encoder == "fdk_aac")
281279
{
282-
audioEncoding.Encoder = "av_aac";
283-
StaticResolver.Resolve<IAppLogger>().Log("Preset specified fdk_aac but it is not supported in this build of VidCoder. Fell back to av_aac.");
280+
// Make sure this version of VidCoder recognizes the encoder
281+
HBAudioEncoder encoder = HandBrakeEncoderHelpers.GetAudioEncoder(audioEncoding.Encoder);
282+
if (encoder == null)
283+
{
284+
audioEncoding.Encoder = "av_aac";
285+
StaticResolver.Resolve<IAppLogger>().Log("Preset specified fdk_aac but it is not supported in this build of VidCoder. Fell back to av_aac.");
286+
}
284287
}
285288
}
286289
}

0 commit comments

Comments
 (0)