Skip to content

Commit cac0ba8

Browse files
Copilotayushjai19
andcommitted
Add null check in UpdateButtonState to prevent potential NullReferenceException
Co-authored-by: ayushjai19 <244442986+ayushjai19@users.noreply.github.com>
1 parent dece85d commit cac0ba8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

WinUIGallery/Samples/ControlPages/Fundamentals/Controls/TemperatureConverterControl.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ private void InputTextBox_TextChanged(object sender, TextChangedEventArgs e)
4444

4545
private void UpdateButtonState()
4646
{
47-
IsConvertButtonEnabled = !string.IsNullOrWhiteSpace(InputTextBox.Text);
47+
IsConvertButtonEnabled = InputTextBox != null && !string.IsNullOrWhiteSpace(InputTextBox.Text);
4848
}
4949

5050
private void Button_Click(object sender, RoutedEventArgs e)

0 commit comments

Comments
 (0)