PresetCollection::load_external_preset : Added check for m_idx_selected before call of the get_selected_preset.

This commit is contained in:
YuSanka 2023-03-01 15:33:13 +01:00
parent 55b3bf879a
commit a507504b22

View File

@ -879,7 +879,7 @@ std::pair<Preset*, bool> PresetCollection::load_external_preset(
// Insert a new profile. // Insert a new profile.
Preset &preset = this->load_preset(path, new_name, std::move(cfg), select == LoadAndSelect::Always); Preset &preset = this->load_preset(path, new_name, std::move(cfg), select == LoadAndSelect::Always);
preset.is_external = true; preset.is_external = true;
if (&this->get_selected_preset() == &preset) if (this->m_idx_selected != size_t(-1) && &this->get_selected_preset() == &preset)
this->get_edited_preset().is_external = true; this->get_edited_preset().is_external = true;
return std::make_pair(&preset, false); return std::make_pair(&preset, false);