mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2026-04-08 10:21:29 -06:00
safety checks for crash prevention
This commit is contained in:
parent
d5c95ac3d8
commit
592237a32b
@ -42,7 +42,12 @@ class SecondaryDisplay(val context: Context) : DisplayManager.DisplayListener {
|
||||
}
|
||||
|
||||
fun updateSurface() {
|
||||
NativeLibrary.secondarySurfaceChanged(pres!!.getSurfaceHolder().surface)
|
||||
val surface = pres?.getSurfaceHolder()?.surface
|
||||
if (surface != null && surface.isValid) {
|
||||
NativeLibrary.secondarySurfaceChanged(surface)
|
||||
} else {
|
||||
Log.w("SecondaryDisplay", "Attempted to update null or invalid surface")
|
||||
}
|
||||
}
|
||||
|
||||
fun destroySurface() {
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
#include "video_core/renderer_base.h"
|
||||
|
||||
bool EmuWindow_Android::OnSurfaceChanged(ANativeWindow* surface) {
|
||||
int w = ANativeWindow_getWidth(surface);
|
||||
int h = ANativeWindow_getHeight(surface);
|
||||
int w = surface== NULL ? 0 : ANativeWindow_getWidth(surface);
|
||||
int h = surface== NULL ? 0 : ANativeWindow_getHeight(surface);
|
||||
if (render_window == surface && w == window_width && h == window_height) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user