[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.
This commit is contained in:
parent
e5b4ef8e95
commit
8addab785d
1 changed files with 1 additions and 1 deletions
|
@ -687,7 +687,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
|
||||||
(*r_len) += used;
|
(*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.");
|
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;
|
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 + "'.");
|
ERR_FAIL_COND_V_MSG(path.is_empty() || !path.begins_with("res://") || !ResourceLoader::exists(path, "Script"), ERR_INVALID_DATA, "Invalid script path: '" + path + "'.");
|
||||||
|
|
Loading…
Reference in a new issue