Fix OpenRA.GetRandomInteger crashing under certain circumstances
OpenRA.GetRandomInteger crashes when the supplied high value is less or equal to the low value. A situation where this might occur is when you try to get a random member of a dynamically generated array that happens to have only a single member.
This commit is contained in:
@@ -43,7 +43,11 @@ OpenRA.SetWinState = function(player, winState)
|
||||
end
|
||||
|
||||
OpenRA.GetRandomInteger = function(low, high)
|
||||
if high <= low then
|
||||
return low
|
||||
else
|
||||
return Internal.GetRandomInteger(low, high)
|
||||
end
|
||||
end
|
||||
|
||||
OpenRA.TakeOre = function(player, amount)
|
||||
|
||||
Reference in New Issue
Block a user