ActionRandomNumber fixed for nonpositive numbers

This commit is contained in:
Jindra Petřík
2018-01-27 20:43:42 +01:00
parent e862df59c1
commit 08b02ae83c
2 changed files with 8 additions and 2 deletions

View File

@@ -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