@@ -294,7 +294,7 @@ private void PopulateComboBox()
294294
295295 private void AddTimestampProvider ( string displayName , string url )
296296 {
297- if ( ! comboBoxTimestampProviders . Items . Cast < TimestampProvider > ( ) . Any ( item => item . DisplayName = = displayName ) )
297+ if ( comboBoxTimestampProviders . Items . Cast < TimestampProvider > ( ) . All ( item => item . DisplayName ! = displayName ) )
298298 {
299299 comboBoxTimestampProviders . Items . Add ( new TimestampProvider ( displayName , url ) ) ;
300300 }
@@ -1499,7 +1499,7 @@ private void ButtonAddDirectory_Click(object sender, EventArgs e)
14991499 if ( folderBrowserDialog . ShowDialog ( ) == DialogResult . OK )
15001500 {
15011501 // count files before add selected files
1502- var currentFiles = checkedListBoxFiles . Items . Count ;
1502+ var currentFiles = checkedListBoxFiles ? . Items . Count ?? 0 ;
15031503 try
15041504 {
15051505 var searchOption = SearchOption . TopDirectoryOnly ;
@@ -1515,15 +1515,15 @@ private void ButtonAddDirectory_Click(object sender, EventArgs e)
15151515 // loop in all files
15161516 foreach ( var file in files )
15171517 {
1518- checkedListBoxFiles . Items . Add ( file ) ;
1518+ checkedListBoxFiles ? . Items . Add ( file ) ;
15191519 }
15201520
15211521 // calc added files
1522- var totalFiles = checkedListBoxFiles . Items . Count ;
1523- var addedFiles = currentFiles - totalFiles ;
1522+ var totalFiles = checkedListBoxFiles ? . Items . Count ?? 0 ;
1523+ var addedFiles = totalFiles - currentFiles ;
15241524
15251525 // show status
1526- statusLabel . Text = @"[INFO] " + addedFiles + @" file(s) imported to File List from folder" ;
1526+ statusLabel . Text = @"[INFO] " + addedFiles + @" file(s) imported to File List from selected folder" ;
15271527 }
15281528 catch
15291529 {
0 commit comments