mirror of
https://github.com/azahar-emu/azahar.git
synced 2026-06-06 02:33:44 -04:00
safety checks for crash prevention
This commit is contained in:
parent
f94b2ad5da
commit
9dd3a8abc0
2 changed files with 8 additions and 3 deletions
|
|
@ -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…
Add table
Reference in a new issue