File tree Expand file tree Collapse file tree 3 files changed +29
-2
lines changed
Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,16 @@ void RenderViewImpl::recreateVkSurface(bool needUpdateRenderSurface)
130130 .width = static_cast <int >(_windowSize.width ),
131131 .height = static_cast <int >(_windowSize.height ),
132132 .createFunc = _createSurface};
133+ if (!createInfo.window )
134+ {
135+ AXLOGE (" recreateVkSurface: ANativeWindow is null, skip" );
136+ return ;
137+ }
138+ if (createInfo.width == 0 || createInfo.height == 0 )
139+ {
140+ AXLOGW (" recreateVkSurface: window size is 0, skip" );
141+ return ;
142+ }
133143 auto driver = static_cast <ax::rhi::vk::DriverImpl*>(axdrv);
134144 bool ok = driver->recreateSurface (createInfo);
135145 if (!ok)
Original file line number Diff line number Diff line change @@ -81,7 +81,24 @@ JNIEXPORT void JNICALL Java_dev_axmol_lib_AxmolPlayer_nativeOnSurfaceCreated(JNI
8181{
8282 if (s_nativeWindow)
8383 ANativeWindow_release (s_nativeWindow);
84- s_nativeWindow = ANativeWindow_fromSurface (env, surface);
84+
85+ s_nativeWindow = ANativeWindow_fromSurface (env, surface);
86+ if (s_nativeWindow == nullptr ) {
87+ AXLOGW (" ANativeWindow_fromSurface failed: surface={}, "
88+ " windowSize=({} x {}), threadId={}" ,
89+ fmt::ptr (surface),
90+ static_cast <int >(w),
91+ static_cast <int >(h),
92+ (long )gettid ());
93+ return ;
94+ }
95+
96+ AXLOGI (" ANativeWindow_fromSurface success: window={}, "
97+ " size=({} x {})" ,
98+ fmt::ptr (s_nativeWindow),
99+ static_cast <int >(w),
100+ static_cast <int >(h));
101+
85102 auto director = ax::Director::getInstance ();
86103 auto renderView = director->getRenderView ();
87104 if (!renderView)
Original file line number Diff line number Diff line change @@ -288,7 +288,7 @@ bool DriverImpl::initializeFactory()
288288 else
289289 {
290290 AXLOGE (" Unsupported window platform: neither WAYLAND_DISPLAY nor DISPLAY found" );
291- assert ( false ) ;
291+ return false ;
292292 }
293293#endif
294294
You can’t perform that action at this time.
0 commit comments