fix preview dialogxml crash

This commit is contained in:
2025-02-09 11:41:49 -06:00
parent 81114d0202
commit cd556335a5

View File

@@ -1152,12 +1152,14 @@ void preview_dialog_xml() {
fs::path dialog_xml = nav_get_rsrc({"xml"}); fs::path dialog_xml = nav_get_rsrc({"xml"});
std::unique_ptr<DialogDefn> defn(load_dialog_defn(dialog_xml)); std::unique_ptr<DialogDefn> defn(load_dialog_defn(dialog_xml));
cDialog dialog(*defn); cDialog dialog(*defn);
// Make every control's click event close the dialog // Make every clickable control's click event close the dialog
for (auto control : dialog){ for (auto control : dialog){
control.second->attachClickHandler([](cDialog& me, std::string item_hit, eKeyMod mod) -> bool { try{
me.toast(false); control.second->attachClickHandler([](cDialog& me, std::string item_hit, eKeyMod mod) -> bool {
return true; me.toast(false);
}); return true;
});
}catch(...){}
} }
dialog.run(); dialog.run();
} }