1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 06:28:35 +01:00

fixed elementhelper crash

This commit is contained in:
Ellpeck 2019-08-24 12:56:58 +02:00
parent cb5594bada
commit 2698153491

View file

@ -17,7 +17,8 @@ namespace MLEM.Ui.Elements {
OnClicked = (element, button) => {
if (button == MouseButton.Left) {
var text = field.Text.ToString();
field.SetText(int.Parse(text) + stepPerClick);
if (int.TryParse(text, out var val))
field.SetText(val + stepPerClick);
}
}
};
@ -28,7 +29,8 @@ namespace MLEM.Ui.Elements {
OnClicked = (element, button) => {
if (button == MouseButton.Left) {
var text = field.Text.ToString();
field.SetText(int.Parse(text) - stepPerClick);
if (int.TryParse(text, out var val))
field.SetText(val - stepPerClick);
}
}
};