B2020-070 Added null reference checks.

This commit is contained in:
John Jenko 2020-05-13 19:43:00 +00:00
parent 9b363aa847
commit 462315f282

View File

@ -164,7 +164,8 @@ namespace Volian.Controls.Library
void tabSearchTypes_SelectedTabChanged(object sender, TabStripTabChangedEventArgs e) void tabSearchTypes_SelectedTabChanged(object sender, TabStripTabChangedEventArgs e)
{ {
wordSectionTreeNode.Enabled = true; if(wordSectionTreeNode != null) //B2020-070 NULL reference check
wordSectionTreeNode.Enabled = true;
btnSearch.Enabled = true; btnSearch.Enabled = true;
if (e.NewTab == tabROSearch) if (e.NewTab == tabROSearch)
{ {
@ -172,8 +173,11 @@ namespace Volian.Controls.Library
} }
else if (e.NewTab == tabTranSearch) else if (e.NewTab == tabTranSearch)
{ {
wordSectionTreeNode.Enabled = false; // C2020-010: Disable Word Section choice for Transition search if (wordSectionTreeNode != null) //B2020-070 NULL reference check
wordSectionTreeNode.Checked = false; {
wordSectionTreeNode.Enabled = false; // C2020-010: Disable Word Section choice for Transition search
wordSectionTreeNode.Checked = false;
}
btnSearch.Enabled = (cbxTranCategory.Items.Count > 0); // B2017-038 disable search button if no format selected btnSearch.Enabled = (cbxTranCategory.Items.Count > 0); // B2017-038 disable search button if no format selected
//enable-disable doc version nodes based on version type if selected //enable-disable doc version nodes based on version type if selected
if (cbxTranVersion.SelectedIndex > -1) if (cbxTranVersion.SelectedIndex > -1)