Commit 9403f17
authored
Adds safety checks to scripting orders with waypoints (#5173)
* Adds safety checks to scripting orders with waypoints
Turns out setting a waypoint order then trying to get to target of that order in the same frame triggers a crash in the scripting API for ship orders (`order.cpp` line 295). This was due to invalid lookups which lacked safety checks.
This PR adds those safety checks. Now, if this situation is encountered, it leaves `objnum` at -1 and thus returns an object for which `isValid` is false.
Fix is tested and works as expected. Also fixes #5172
* appease clang
* cleanup thanks to Goober
* clang again
* forgot to re-add the nullptr
* remove redundant checks1 parent 9a7b3fe commit 9403f17
1 file changed
+7
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
292 | | - | |
293 | | - | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
294 | 295 | | |
295 | 296 | | |
296 | | - | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
297 | 301 | | |
298 | 302 | | |
299 | 303 | | |
| |||
0 commit comments