Skip to content

Commit

Permalink
Merge pull request #90335 from Faless/io/marshall_nil_script
Browse files Browse the repository at this point in the history
[IO] Fix marshall decoding when script is NIL
  • Loading branch information
akien-mga committed Apr 8, 2024
2 parents bca2c30 + 8addab7 commit 9738cc7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/io/marshalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "'.");
Expand Down

0 comments on commit 9738cc7

Please sign in to comment.