Skip to content

Commit

Permalink
Prevents a possible NPE in RandomUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisDrogoul committed Jul 31, 2021
1 parent 048d899 commit 11ed4cb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions msi.gama.core/src/msi/gama/common/util/RandomUtils.java
Expand Up @@ -82,9 +82,9 @@ public void setState(final State state) {
* Inits the generator.
*/
private void initGenerator() {
if (generatorName.equals(IKeyword.CELLULAR)) {
if (IKeyword.CELLULAR.equals(generatorName)) {
generator = new CellularAutomatonRNG(this);
} else if (generatorName.equals(IKeyword.JAVA)) {
} else if (IKeyword.JAVA.equals(generatorName)) {
generator = new JavaRNG(this);
} else {
/* By default */
Expand Down Expand Up @@ -240,6 +240,7 @@ public void setGenerator(final String newGen, final boolean init) {
// }

public void shuffleInPlace(final Collection list) {
if (list == null) return;
final int size = list.size();
if (size < 2) return;
final Object[] a = list.toArray(new Object[size]);
Expand Down

0 comments on commit 11ed4cb

Please sign in to comment.