MainForm - Fix model selector ignoring cancel button

This commit is contained in:
miku-666
2024-12-24 13:06:51 +01:00
parent 6715e80d40
commit 17e3856e13

View File

@@ -560,11 +560,12 @@ namespace PckStudio
using ItemSelectionPopUp itemSelectionPopUp = new ItemSelectionPopUp(modelNames.ToArray());
itemSelectionPopUp.ButtonText = "View";
itemSelectionPopUp.LabelText = "Models:";
if (itemSelectionPopUp.ShowDialog() == DialogResult.OK && modelNames.IndexInRange(itemSelectionPopUp.SelectedIndex))
if (itemSelectionPopUp.ShowDialog() != DialogResult.OK || !modelNames.IndexInRange(itemSelectionPopUp.SelectedIndex))
{
return;
}
modelName = modelNames[itemSelectionPopUp.SelectedIndex];
}
}
NamedTexture modelTexture = new NamedTexture(Path.GetFileName(texturePath), asset.GetTexture());