Commit 0da8350
Fix NPE in ParticleMathMapping when reaction has non-mass-action kinetics
`transformToStochastic` returns a `GeneralKineticsStochasticFunction`
when a reaction's rate law cannot be reduced to mass-action form (e.g.
Hill / Michaelis-Menten kinetics). The existing `instanceof
MassActionStochasticFunction` check correctly leaves `maFunc` null in
that case, but the next line dereferenced it unconditionally
(`maFunc.forwardRate()`), producing an NPE far from the real cause.
Particle math mapping requires mass-action shape regardless, so the
correct behavior is to throw the same `MappingException` whether
`maFunc` is null or has both rates null. Adding `maFunc == null ||`
to the guard yields a descriptive error pointing at the offending
reaction instead of an NPE.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent c5f4f2c commit 0da8350
1 file changed
Lines changed: 5 additions & 1 deletion
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
729 | 729 | | |
730 | 730 | | |
731 | 731 | | |
732 | | - | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
733 | 737 | | |
734 | 738 | | |
735 | 739 | | |
| |||
0 commit comments