mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 20:58:34 +01:00
fixed elementhelper crash
This commit is contained in:
parent
cb5594bada
commit
2698153491
1 changed files with 4 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue