Commit 88b838c
Fix NPE in StochMathMapping.getProbabilityRate for symbol-less rate expressions
`Expression.getSymbols()` is documented to return null when the expression
has no free symbols (see Expression.java:545). The general-kinetics path
in StochMathMapping was iterating over the result with an unguarded
for-each, producing an NPE whose corpus signature is:
Cannot read the array length because "<local7>" is null
at cbit.vcell.mapping.StochMathMapping.getProbabilityRate
(StochMathMapping.java:145)
This trips when a non-mass-action rate expression flattens to a constant
or otherwise contains no free symbols (e.g. a Michaelis-Menten rate where
all parameters and species have already been resolved upstream). The fix
mirrors the established null-guard pattern already used in
AbstractStochMathMapping.getSubstitutedExpr (line 155).
The general-kinetics fallback in StochasticTransformer is the intended
path for non-mass-action kinetics — it takes the authoritative reaction
rate as a net flux and uses max(rate, 0) as the irreversible forward
rate, which is exactly the right shape for stochastic simulation. The
NPE was preventing that path from completing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent c5f4f2c commit 88b838c
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 | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
146 | 150 | | |
147 | 151 | | |
148 | 152 | | |
| |||
0 commit comments