VariantParser: Fix uninitialized ResourceParser funcs

They could cause a segfault when parsing values with ID "Resource"
as apparently we never set a valid `func` for it.

Fixes crash part of #42115.

(cherry picked from commit f3aaa713d9)
This commit is contained in:
Rémi Verschelde 2021-07-30 23:22:00 +02:00
parent f84de49718
commit 7be11742b5
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 4 additions and 6 deletions

View File

@ -76,11 +76,10 @@ public:
typedef Error (*ParseResourceFunc)(void *p_self, Stream *p_stream, Ref<Resource> &r_res, int &line, String &r_err_str);
struct ResourceParser {
void *userdata;
ParseResourceFunc func;
ParseResourceFunc ext_func;
ParseResourceFunc sub_func;
void *userdata = nullptr;
ParseResourceFunc func = nullptr;
ParseResourceFunc ext_func = nullptr;
ParseResourceFunc sub_func = nullptr;
};
enum TokenType {

View File

@ -898,7 +898,6 @@ void ResourceInteractiveLoaderText::open(FileAccess *p_f, bool p_skip_first_tag)
rp.ext_func = _parse_ext_resources;
rp.sub_func = _parse_sub_resources;
rp.func = NULL;
rp.userdata = this;
}