mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-18 07:11:51 +00:00
ActionRandomNumber fixed for nonpositive numbers
This commit is contained in:
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -41,7 +42,11 @@ public class RandomNumberActionItem extends ActionItem {
|
||||
}
|
||||
|
||||
public static Integer getResult(Object maximum) {
|
||||
public static Integer getResult(Object maximum) {
|
||||
int maximumInt = EcmaScript.toInt32(maximum);
|
||||
if (maximumInt <= 0) {
|
||||
return 0;
|
||||
}
|
||||
return rnd.nextInt(maximumInt);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user