don't allow going out of bounds

This commit is contained in:
tildearrow 2025-11-16 20:06:34 -05:00
parent 06c698e054
commit 96152f90f3

View file

@ -2812,7 +2812,12 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
ImGui::TextUnformatted(_("Channels"));
ImGui::SameLine();
ImGui::SetNextItemWidth(120.0f*dpiScale);
ImGui::InputInt("##ChCount",&chCount,0,0);
if (ImGui::InputInt("##ChCount",&chCount,0,0)) {
if (sysDef!=NULL) {
if (chCount<sysDef->minChans) chCount=sysDef->minChans;
if (chCount>sysDef->maxChans) chCount=sysDef->maxChans;
}
}
if (ImGui::IsItemDeactivatedAfterEdit() && chCount!=e->song.systemChans[chan]) {
if (e->setSystemChans(chan,chCount,preserveChanPos)) {
MARK_MODIFIED;