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:
parent
61d153a1fa
commit
69c194736d
|
@ -73,10 +73,10 @@ public:
|
||||||
typedef Error (*ParseResourceFunc)(void *p_self, Stream *p_stream, Ref<Resource> &r_res, int &line, String &r_err_str);
|
typedef Error (*ParseResourceFunc)(void *p_self, Stream *p_stream, Ref<Resource> &r_res, int &line, String &r_err_str);
|
||||||
|
|
||||||
struct ResourceParser {
|
struct ResourceParser {
|
||||||
void *userdata;
|
void *userdata = nullptr;
|
||||||
ParseResourceFunc func;
|
ParseResourceFunc func = nullptr;
|
||||||
ParseResourceFunc ext_func;
|
ParseResourceFunc ext_func = nullptr;
|
||||||
ParseResourceFunc sub_func;
|
ParseResourceFunc sub_func = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TokenType {
|
enum TokenType {
|
||||||
|
|
|
@ -853,7 +853,6 @@ void ResourceInteractiveLoaderText::open(FileAccess *p_f, bool p_skip_first_tag)
|
||||||
|
|
||||||
rp.ext_func = _parse_ext_resources;
|
rp.ext_func = _parse_ext_resources;
|
||||||
rp.sub_func = _parse_sub_resources;
|
rp.sub_func = _parse_sub_resources;
|
||||||
rp.func = nullptr;
|
|
||||||
rp.userdata = this;
|
rp.userdata = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue