bb4 / bb4-simulations

A collection of java simulations. Examples include reaction diffusion, fractals, henon phase exploration, snakes, dice, and fluid flow.
MIT License
5 stars 2 forks source link

WFC: NPE for Flowers model #25

Closed barrybecker4 closed 3 years ago

barrybecker4 commented 3 years ago

I often get a stack trace like this

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at com.barrybecker4.simulation.waveFunctionCollapse.model.wave.Wave.doPropagation(Wave.scala:147)
    at com.barrybecker4.simulation.waveFunctionCollapse.model.wave.Wave.propagate(Wave.scala:139)
    at com.barrybecker4.simulation.waveFunctionCollapse.model.WfcModel.$anonfun$advance$2(WfcModel.scala:65)
    at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:190)
    at com.barrybecker4.simulation.waveFunctionCollapse.model.WfcModel.advance(WfcModel.scala:59)
    at com.barrybecker4.simulation.waveFunctionCollapse.model.WfcModel.runWithLimit(WfcModel.scala:43)
    at com.barrybecker4.simulation.waveFunctionCollapse.model.WfcModel.startRun(WfcModel.scala:49)
    at com.barrybecker4.simulation.waveFunctionCollapse.DynamicOptions.runModel(DynamicOptions.scala:248)
    at com.barrybecker4.simulation.waveFunctionCollapse.DynamicOptions.itemStateChanged(DynamicOptions.scala:261)
    at java.desktop/javax.swing.JComboBox.fireItemStateChanged(JComboBox.java:1227)
    at java.desktop/javax.swing.JComboBox.selectedItemChanged(JComboBox.java:1279)
barrybecker4 commented 3 years ago

Fixed. This was due to a concurrency issue.