Skip to content

Commit be6758f

Browse files
committed
fix oh crash
1 parent 6a87599 commit be6758f

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

native/cocos/renderer/gfx-gles2/GLES2Wrangler.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ void *gles2wLoad(const char *proc) {
6666
}
6767
#else
6868
#include <dlfcn.h>
69-
#include "BasePlatform.h"
7069
#include "../gfx-gles-common/eglw.h"
7170
#include "../gfx-gles-common/gles2w.h"
71+
#include "BasePlatform.h"
7272

7373
namespace {
74-
void *libegl = nullptr;
75-
void *libgles = nullptr;
76-
}
74+
void *libegl = nullptr;
75+
void *libgles = nullptr;
76+
} // namespace
7777

7878
bool gles2wOpen() {
7979
libegl = dlopen("libEGL.so", RTLD_LAZY | RTLD_GLOBAL);
@@ -103,12 +103,18 @@ bool gles2wClose() {
103103
void *gles2wLoad(const char *proc) {
104104
void *res = nullptr;
105105
if (eglGetProcAddress) res = reinterpret_cast<void *>(eglGetProcAddress(proc));
106+
107+
#if CC_PLATFORM != CC_PLATFORM_OPENHARMONY
106108
auto sdkVersion = cc::BasePlatform::getPlatform()->getSdkVersion();
107109
if (sdkVersion <= 23) {
108110
if (!res) res = dlsym(libgles, proc);
109111
} else {
110112
if (!res) res = dlsym(libegl, proc);
111113
}
114+
#else
115+
if (!res) res = dlsym(libegl, proc);
116+
#endif
117+
112118
return res;
113119
}
114120
#endif

0 commit comments

Comments
 (0)