Files
fs2open.github.com/code
MageKing17 acaa93a9d2 Avoid setting .rest for Locked_sexp_true/false with malformed SEXPs. (#4221)
* Avoid setting .rest for Locked_sexp_true/false with malformed SEXPs.

When FRED puts a `true` in the middle of a list of arguments, it wraps it in a nested list as `(true)`, because it's technically an operator; however, if someone writes a SEXP by hand, they could easily forget to do this, and in such cases, this causes `Locked_sexp_true` to be inserted into the middle of the list. If it's not the last element of the list, it will then have its `.rest` attribute set to the next node in the list. If this is a temporary SEXP (i.e. from Lua's `runSEXP()` function), this used to be a temporary problem, but PR #4088 changed the global search for any node with `.rest` set to the node being freed to require an explicit parent node. This means that `Locked_sexp_true.rest` remains set to a freed node, which can cause further issues. If such a malformed SEXP *isn't* temporary it can cause even more issues, even pre-#4088.

This commit changes `get_sexp()` so that if it detects `true` or `false` in the middle of a list (and not a single-element list), it will put it into a single-element sub-list, hopefully preventing any modification of `Locked_sexp_true` or `Locked_sexp_false`, as giving a `Warning`. This should cause it to behave as though `true` or `false` was actually `(true)` or `(false)`, respectively, and therefore run as expected.

* Add comment and remove unused variable declaration.

Thanks to @PhantomHoover for the wording on the comment.
2022-04-27 20:54:00 -07:00
..
2020-10-19 03:31:01 -04:00
2021-03-14 23:43:22 -03:00
2022-04-10 22:12:42 -05:00
2018-07-15 19:37:24 +02:00
2022-01-19 01:35:32 -05:00
2022-04-08 22:02:34 -04:00
2022-04-09 13:23:03 -04:00
2019-07-20 16:12:45 -04:00
2022-04-12 21:35:06 -04:00
2022-03-19 16:52:54 -04:00
2022-02-10 22:43:59 +09:00
2022-04-24 17:12:46 -05:00
2016-08-12 16:13:50 -07:00
2019-11-03 16:27:23 -05:00
2022-04-02 18:45:46 -04:00
2020-06-06 23:24:08 +02:00
2020-10-06 14:31:03 -04:00
2018-04-25 11:57:55 +02:00
2021-10-20 15:31:23 -04:00
2022-02-12 19:34:01 -05:00
2016-07-22 12:07:19 +02:00