Skip to content

Fix nullable reference warnings #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SqlcmdGuiApp/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private void App_DispatcherUnhandledException(object sender, DispatcherUnhandled

private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
LogError(e.ExceptionObject.ToString());
LogError(e.ExceptionObject?.ToString() ?? string.Empty);
}

private void TaskScheduler_UnobservedTaskException(object? sender, UnobservedTaskExceptionEventArgs e)
Expand Down
8 changes: 6 additions & 2 deletions SqlcmdGuiApp/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ private void ExecuteButton_Click(object sender, RoutedEventArgs e)
try
{
var process = Process.Start(psi);
if (process == null)
{
throw new InvalidOperationException("Failed to start sqlcmd process.");
}
process.WaitForExit();
var output = process.StandardOutput.ReadToEnd();
var error = process.StandardError.ReadToEnd();
Expand All @@ -121,7 +125,7 @@ private void ExecuteButton_Click(object sender, RoutedEventArgs e)

public class SqlParameter
{
public string Name { get; set; }
public string Value { get; set; }
public string Name { get; set; } = string.Empty;
public string Value { get; set; } = string.Empty;
}
}