fix nullreference when using empty password (fix #4)

pull/9/head
Sleevezipper 4 years ago
parent 8b26331fd6
commit 6a122e3337

@ -45,7 +45,7 @@ namespace UserInterface.Views
public void Configure(object sender, RoutedEventArgs args) public void Configure(object sender, RoutedEventArgs args)
{ {
var model = (BrokerSettingsViewModel)this.DataContext; var model = (BrokerSettingsViewModel)this.DataContext;
var result = this.client.InvokeAsync(x => x.WriteMqttBrokerSettingsAsync(new MqttSettings() { Host = model.Host, Username = model.Username, Password = model.Password })); var result = this.client.InvokeAsync(x => x.WriteMqttBrokerSettingsAsync(new MqttSettings() { Host = model.Host, Username = model.Username, Password = model.Password ?? "" }));
} }
public async void GetSettings() public async void GetSettings()

@ -226,7 +226,7 @@ namespace hass_workstation_service.Data
{ {
Host = settings.Host, Host = settings.Host,
Username = settings.Username, Username = settings.Username,
Password = settings.Password Password = settings.Password ?? ""
}; };
await JsonSerializer.SerializeAsync(stream, configuredBroker); await JsonSerializer.SerializeAsync(stream, configuredBroker);

Loading…
Cancel
Save