[android] Fix crash caused by unreferenced driver (#58)
All checks were successful
eden-build / source (push) Successful in 9m44s
eden-build / linux (push) Successful in 30m48s
eden-build / android (push) Successful in 38m17s
eden-build / windows (msvc) (push) Successful in 29m9s

Previously, if the user selected a per-game driver and that driver was
deleted from the global menu, it would cause a crash, it was because of
a mismatch between FileNotFoundException and NoSuchFileException. To
avoid the inconsistency I just made the check for if a file exists or
not to be separate.

Signed-off-by: Aleksandr Popovich <popovich@eden-emu.dev>

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/58
Co-authored-by: Aleksandr Popovich <popovich@eden-emu.dev>
Co-committed-by: Aleksandr Popovich <popovich@eden-emu.dev>
This commit is contained in:
Aleksandr Popovich 2025-07-14 02:18:33 +02:00 committed by crueter
parent 492903cc7a
commit 2be7df287a
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@ -177,6 +180,10 @@ object GpuDriverHelper {
* @return A non-null [GpuDriverMetadata] instance that may have null members
*/
fun getMetadataFromZip(driver: File): GpuDriverMetadata {
if (!driver.exists()) {
return GpuDriverMetadata()
}
try {
ZipFile(driver).use { zf ->
val entries = zf.entries()