fix null check for fribidi_version_info in fribidi shim

This commit is contained in:
nulano 2022-06-17 17:13:11 +01:00
parent 765d66c069
commit c2047b8293
No known key found for this signature in database
GPG Key ID: B650CDF63B705766

View File

@ -33,6 +33,7 @@ static void fribidi_get_bracket_types_compat(
int load_fribidi(void) {
int error = 0;
const char **p_fribidi_version_info = 0;
p_fribidi = 0;
@ -87,20 +88,21 @@ int load_fribidi(void) {
LOAD_FUNCTION(fribidi_get_par_embedding_levels);
#ifndef _WIN32
fribidi_version_info = *(const char**)dlsym(p_fribidi, "fribidi_version_info");
if (error || (fribidi_version_info == 0)) {
p_fribidi_version_info = (const char**)dlsym(p_fribidi, "fribidi_version_info");
if (error || (p_fribidi_version_info == 0) || (*p_fribidi_version_info == 0)) {
dlclose(p_fribidi);
p_fribidi = 0;
return 2;
}
#else
fribidi_version_info = *(const char**)GetProcAddress(p_fribidi, "fribidi_version_info");
if (error || (fribidi_version_info == 0)) {
p_fribidi_version_info = (const char**)GetProcAddress(p_fribidi, "fribidi_version_info");
if (error || (p_fribidi_version_info == 0) || (*p_fribidi_version_info == 0)) {
FreeLibrary(p_fribidi);
p_fribidi = 0;
return 2;
}
#endif
fribidi_version_info = *p_fribidi_version_info;
return 0;
}