Check the return value of get_field() before use

Other calls to toggle() check if the field exists first,
this one should too.

Fixes #2126

Signed-off-by: Stephen Hurd <shurd@sasktel.net>
This commit is contained in:
Stephen Hurd 2022-01-05 02:52:15 -05:00 committed by supermerill
parent c148bbc1bf
commit 0d5add8413

View File

@ -3032,8 +3032,11 @@ void TabPrinter::toggle_options()
}
// wipe_only_crossing can only work if avoid_crossing_perimeters
if (!full_print_config.opt_bool("avoid_crossing_perimeters"))
get_field("wipe_only_crossing", i)->toggle(false);
if (!full_print_config.opt_bool("avoid_crossing_perimeters")) {
field = get_field("wipe_only_crossing", i);
if (field)
field->toggle(false);
}
if (use_firmware_retraction && wipe) {
wxMessageDialog dialog(parent(),