Skip to content

Commit

Permalink
Added workaround for crash if a registered species doesn't have a reg…
Browse files Browse the repository at this point in the history
…istered template (#75)
  • Loading branch information
bdew committed Jan 16, 2015
1 parent 1687448 commit 9b417ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Expand Up @@ -3,10 +3,8 @@
/build
/run
/deps/run
/.idea/workspace.xml
/.idea/dictionaries
/.idea
/eclipse
/.gradle
/*.iml
/*.ipr
/.idea/libraries/Gradle__*
/*.ipr
10 changes: 7 additions & 3 deletions src/net/bdew/gendustry/misc/GeneticsCache.scala
Expand Up @@ -91,9 +91,13 @@ object GeneticsCache {
Gendustry.logInfo("%d mutation inputs", speciesUsedMutations.size)

for (species <- Misc.filterType(AlleleManager.alleleRegistry.getRegisteredAlleles.values(), classOf[IAlleleSpecies])) {
for ((allele, chromosome) <- species.getRoot.getTemplate(species.getUID).zipWithIndex) {
if (allele != null && !AlleleManager.alleleRegistry.isBlacklisted(allele.getUID))
speciesChromosomes(GeneSampleInfo(species.getRoot, chromosome, allele)) += species
if (species.getRoot.getTemplate(species.getUID) == null) {
Gendustry.logWarn("getTemplate returned null for species %s (root: %s)", species.getUID, species.getRoot.getUID)
} else {
for ((allele, chromosome) <- species.getRoot.getTemplate(species.getUID).zipWithIndex) {
if (allele != null && !AlleleManager.alleleRegistry.isBlacklisted(allele.getUID))
speciesChromosomes(GeneSampleInfo(species.getRoot, chromosome, allele)) += species
}
}
}

Expand Down

0 comments on commit 9b417ae

Please sign in to comment.