Commit 6103c21
Fix standalone crash when client disconnects before mission loads
When a client connects to a standalone server and backs out before a
mission is loaded, multi_standalone_reset_all() calls game_level_close()
which fires OnMissionAboutToEnd/OnMissionEnd scripting hooks. If any
mod script calls mn.evaluateSEXP() from those hooks, alloc_sexp() crashes
because the SEXP system was never initialized (Locked_sexp_true/false
are still -1, Sexp_nodes is nullptr).
Guard multi_standalone_reset_all() to only call game_level_close() when
GM_IN_MISSION is set. Additionally, guard evaluateSEXP, evaluateNumericSEXP,
and runSEXP to gracefully return with a warning when the SEXP system is
not initialized, rather than crashing.
Fixes #7353
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 43a475a commit 6103c21
2 files changed
Lines changed: 22 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1671 | 1671 | | |
1672 | 1672 | | |
1673 | 1673 | | |
1674 | | - | |
1675 | | - | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
1676 | 1681 | | |
1677 | 1682 | | |
1678 | 1683 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
204 | 209 | | |
205 | 210 | | |
206 | 211 | | |
| |||
218 | 223 | | |
219 | 224 | | |
220 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
221 | 231 | | |
222 | 232 | | |
223 | 233 | | |
| |||
235 | 245 | | |
236 | 246 | | |
237 | 247 | | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
238 | 253 | | |
239 | 254 | | |
240 | 255 | | |
| |||
0 commit comments