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
|
end
|
||||||
|
|
||||||
OpenRA.GetRandomInteger = function(low, high)
|
OpenRA.GetRandomInteger = function(low, high)
|
||||||
return Internal.GetRandomInteger(low, high)
|
if high <= low then
|
||||||
|
return low
|
||||||
|
else
|
||||||
|
return Internal.GetRandomInteger(low, high)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
OpenRA.TakeOre = function(player, amount)
|
OpenRA.TakeOre = function(player, amount)
|
||||||
|
|||||||
Reference in New Issue
Block a user