Skip to content

Commit 2232d81

Browse files
committed
Improved null AudioEncodings check to change it to an empty List.
1 parent c25f3b6 commit 2232d81

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

VidCoder/Model/PresetStorage.cs

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

274-
if (profile.AudioEncodings != null)
274+
if (profile.AudioEncodings == null)
275275
{
276-
foreach (var audioEncoding in profile.AudioEncodings)
276+
profile.AudioEncodings = new List<AudioEncoding>();
277+
}
278+
279+
foreach (var audioEncoding in profile.AudioEncodings)
280+
{
281+
if (audioEncoding.Encoder == "fdk_aac")
277282
{
278-
if (audioEncoding.Encoder == "fdk_aac")
283+
// Make sure this version of VidCoder recognizes the encoder
284+
HBAudioEncoder encoder = HandBrakeEncoderHelpers.GetAudioEncoder(audioEncoding.Encoder);
285+
if (encoder == null)
279286
{
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-
}
287+
audioEncoding.Encoder = "av_aac";
288+
StaticResolver.Resolve<IAppLogger>().Log("Preset specified fdk_aac but it is not supported in this build of VidCoder. Fell back to av_aac.");
287289
}
288290
}
289291
}

0 commit comments

Comments
 (0)