knxprodeditor / KNXprodEditor

A user friendly editor for knxprod files
MIT License
9 stars 2 forks source link

Fix GUI crash when saving relative code segments #3

Closed ulikoehler closed 2 years ago

ulikoehler commented 2 years ago

We were seeing the following error message when saving ApplicationProgram error messages containing relative code segments: photo5262853479578320406 with the following additional info from VS: photo5262853479578320416

This issue occurs due to

newAbsCodeSegmentId = ((comboBoxParParMemCodeSegment.SelectedItem as ComboBoxItem).Tag as ApplicationProgramStatic_tCodeAbsoluteSegment).Id;

in the save code not taking into account that Tag might also be a ApplicationProgramStatic_tCodeRelativeSegment.

This pulls request fixes this issue by extracting newAbsCodeSegmentId from either ApplicationProgramStatic_tCodeAbsoluteSegment or ApplicationProgramStatic_tCodeRelativeSegment. For me, this quick fix works so that the error message doesn't appear any more and changes to the offset are saved into the KNXPROD file.

knxprodeditor commented 2 years ago

Very good, thank you for fixing!

ulikoehler commented 2 years ago

Thanks for merging!