diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2024-04-07 09:53:58 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2024-04-07 09:55:15 +0200 |
commit | 8addab785d01a0a7860267c06b785b7bfde88e19 (patch) | |
tree | c96c6b1224cd9823a69e46c01554dcbb60c3ac3c | |
parent | e5b4ef8e9522e950033cbece39a31a4a76da19c1 (diff) | |
download | redot-engine-8addab785d01a0a7860267c06b785b7bfde88e19.tar.gz |
[IO] Fix marshall decoding when script is NIL
We changed how scripts are binary serialized, and added a check to
ensure the new format is enforced, but there is still a case where the
old format (plain "prop"-"value" combo) is used, and that is when the
script is NIL.
-rw-r--r-- | core/io/marshalls.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index b25fcccd7f..f0bbf00a1d 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -687,7 +687,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int (*r_len) += used; } - if (str == "script") { + if (str == "script" && value.get_type() != Variant::NIL) { ERR_FAIL_COND_V_MSG(value.get_type() != Variant::STRING, ERR_INVALID_DATA, "Invalid value for \"script\" property, expected script path as String."); String path = value; ERR_FAIL_COND_V_MSG(path.is_empty() || !path.begins_with("res://") || !ResourceLoader::exists(path, "Script"), ERR_INVALID_DATA, "Invalid script path: '" + path + "'."); |