WinGui: Remove the potential for an NPE in the audio behaviours constructor. #7411

This commit is contained in:
sr55 2025-11-14 19:27:21 +00:00
parent fdfc925e27
commit 479dfa051a
1 changed files with 6 additions and 3 deletions

View File

@ -13,7 +13,6 @@ namespace HandBrakeWPF.Model.Audio
using System.ComponentModel;
using System.Linq;
using HandBrake.App.Core.Utilities;
using HandBrake.Interop.Interop;
using HandBrake.Interop.Interop.Interfaces.Model;
using HandBrake.Interop.Interop.Interfaces.Model.Encoders;
@ -45,9 +44,13 @@ namespace HandBrakeWPF.Model.Audio
{
this.SelectedBehaviour = behaviours.SelectedBehaviour;
this.SelectedTrackDefaultBehaviour = behaviours.SelectedTrackDefaultBehaviour;
this.SelectedLanguages = new BindingList<Language>(behaviours.selectedLanguages.ToList());
this.SelectedLanguages = behaviours.selectedLanguages != null
? new BindingList<Language>(behaviours.selectedLanguages.ToList())
: new BindingList<Language>();
this.BehaviourTracks = behaviours.BehaviourTracks;
this.AllowedPassthruOptions = new BindingList<HBAudioEncoder>(behaviours.AllowedPassthruOptions);
this.AllowedPassthruOptions = behaviours.AllowedPassthruOptions != null
? new BindingList<HBAudioEncoder>(behaviours.AllowedPassthruOptions)
: new BindingList<HBAudioEncoder>();
this.AudioFallbackEncoder = behaviours.AudioFallbackEncoder;
this.AudioTrackNamePassthru = behaviours.AudioTrackNamePassthru;
this.AudioAutomaticNamingBehavior = behaviours.AudioAutomaticNamingBehavior;