Replaced port area helper and avoided crash when searching at a harbour that has no entries

This commit is contained in:
Daniel Schick 2024-07-22 13:29:54 +02:00
parent 703986bbbc
commit ee6658bafd
2 changed files with 9 additions and 6 deletions

View File

@ -523,15 +523,18 @@ namespace ENI2.DetailViewControls
private void buttonSearchPortArea_Click(object sender, RoutedEventArgs e) private void buttonSearchPortArea_Click(object sender, RoutedEventArgs e)
{ {
SelectPortAreaDialog spad = new SelectPortAreaDialog(this.Core.PoC); if (portAreas != null)
if(spad.ShowDialog() ?? false)
{ {
if(spad.SelectedArea != null) SelectPortAreaDialog spad = new SelectPortAreaDialog(this.Core.PoC);
if (spad.ShowDialog() ?? false)
{ {
if (portAreas.ContainsKey(spad.SelectedArea)) if (spad.SelectedArea != null)
{ {
var pair = portAreas.SingleOrDefault(p => p.Key == spad.SelectedArea); if (portAreas.ContainsKey(spad.SelectedArea))
this.comboBoxPortArea.SelectedItem = pair; {
var pair = portAreas.SingleOrDefault(p => p.Key == spad.SelectedArea);
this.comboBoxPortArea.SelectedItem = pair;
}
} }
} }
} }

Binary file not shown.