99using System . Windows . Shell ;
1010using HandBrake . Interop ;
1111using HandBrake . Interop . Model ;
12+ using HandBrake . Interop . Model . Encoding ;
1213using HandBrake . Interop . SourceData ;
1314using VidCoder . Model ;
1415using VidCoder . Properties ;
@@ -1466,6 +1467,10 @@ public ICommand OpenFileCommand
14661467 this . openFileCommand = new RelayCommand ( param =>
14671468 {
14681469 this . SetSourceFromFile ( ) ;
1470+ } ,
1471+ param =>
1472+ {
1473+ return ! this . ScanningSource ;
14691474 } ) ;
14701475 }
14711476
@@ -1482,6 +1487,10 @@ public ICommand OpenFolderCommand
14821487 this . openFolderCommand = new RelayCommand ( param =>
14831488 {
14841489 this . SetSourceFromFolder ( ) ;
1490+ } ,
1491+ param =>
1492+ {
1493+ return ! this . ScanningSource ;
14851494 } ) ;
14861495 }
14871496
@@ -1635,17 +1644,30 @@ public EncodeJob EncodeJob
16351644 {
16361645 get
16371646 {
1647+ // Break out values to find where the reported null reference crashes are coming from.
1648+ SourceType type = this . SelectedSource . Type ;
1649+
1650+ string outputPath = this . OutputPathVM . OutputPath ;
1651+
1652+ EncodingProfile encodingProfile = this . PresetsVM . SelectedPreset . Preset . EncodingProfile . Clone ( ) ;
1653+
1654+ int title = this . SelectedTitle . TitleNumber ;
1655+
1656+ int startChapter = this . SelectedStartChapter . ChapterNumber ;
1657+
1658+ int endChapter = this . SelectedEndChapter . ChapterNumber ;
1659+
16381660 return new EncodeJob
16391661 {
1640- SourceType = this . SelectedSource . Type ,
1662+ SourceType = type ,
16411663 SourcePath = this . SourcePath ,
1642- OutputPath = this . OutputPathVM . OutputPath ,
1643- EncodingProfile = this . PresetsVM . SelectedPreset . Preset . EncodingProfile . Clone ( ) ,
1644- Title = this . SelectedTitle . TitleNumber ,
1664+ OutputPath = outputPath ,
1665+ EncodingProfile = encodingProfile ,
1666+ Title = title ,
16451667 Angle = this . Angle ,
16461668 RangeType = this . VideoRangeType ,
1647- ChapterStart = this . SelectedStartChapter . ChapterNumber ,
1648- ChapterEnd = this . SelectedEndChapter . ChapterNumber ,
1669+ ChapterStart = startChapter ,
1670+ ChapterEnd = endChapter ,
16491671 SecondsStart = this . SecondsRangeStart ,
16501672 SecondsEnd = this . SecondsRangeEnd ,
16511673 FramesStart = this . FramesRangeStart ,
0 commit comments