mirror of https://github.com/WerWolv/ImHex.git
fix: Crash when deleting last environment variable in pattern editor
This commit is contained in:
parent
7ed153a47b
commit
0f9434740f
|
@ -1 +1 @@
|
||||||
Subproject commit 62042c3c782a6f4cf69c5ecc7bbb5a68fdec623c
|
Subproject commit f0780b7a7625fb17297adfe0baafdbe730a58aa9
|
|
@ -341,10 +341,13 @@ namespace hex::plugin::builtin {
|
||||||
{
|
{
|
||||||
if (ImGui::IconButton(ICON_VS_REMOVE, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
if (ImGui::IconButton(ICON_VS_REMOVE, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||||
bool isFirst = iter == envVars.begin();
|
bool isFirst = iter == envVars.begin();
|
||||||
|
bool isLast = std::next(iter) == envVars.end();
|
||||||
envVars.erase(iter);
|
envVars.erase(iter);
|
||||||
|
|
||||||
if (isFirst)
|
if (isFirst)
|
||||||
iter = envVars.begin();
|
iter = envVars.begin();
|
||||||
|
if (isLast)
|
||||||
|
iter = std::prev(envVars.end());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
|
|
Loading…
Reference in New Issue