mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-26 22:10:17 +00:00
check if int and float values are inside range when loading them
This commit is contained in:
parent
e58b567b5d
commit
759eb3c8b8
1 changed files with 6 additions and 2 deletions
|
@ -111,7 +111,9 @@ namespace SanAndreasUnity.UI {
|
|||
|
||||
public override int Load (string str)
|
||||
{
|
||||
return int.Parse (str, System.Globalization.CultureInfo.InvariantCulture);
|
||||
int value = int.Parse (str, System.Globalization.CultureInfo.InvariantCulture);
|
||||
value = Mathf.Clamp(value, this.minValue, this.maxValue);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,7 +137,9 @@ namespace SanAndreasUnity.UI {
|
|||
|
||||
public override float Load (string str)
|
||||
{
|
||||
return float.Parse (str, System.Globalization.CultureInfo.InvariantCulture);
|
||||
float value = float.Parse (str, System.Globalization.CultureInfo.InvariantCulture);
|
||||
value = Mathf.Clamp(value, this.minValue, this.maxValue);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue