[Scummvm-git-logs] scummvm master -> 3093320a36810d4533352abdf9085254684e99fc
lephilousophe
noreply at scummvm.org
Fri Jul 25 13:47:08 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
3093320a36 ANDROID: Avoid crash when tree is removed
Commit: 3093320a36810d4533352abdf9085254684e99fc
https://github.com/scummvm/scummvm/commit/3093320a36810d4533352abdf9085254684e99fc
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-07-25T15:46:43+02:00
Commit Message:
ANDROID: Avoid crash when tree is removed
Changed paths:
backends/fs/android/android-saf-fs.cpp
backends/platform/android/org/scummvm/scummvm/SAFFSTree.java
diff --git a/backends/fs/android/android-saf-fs.cpp b/backends/fs/android/android-saf-fs.cpp
index cce887a8f8e..4837b46ecdf 100644
--- a/backends/fs/android/android-saf-fs.cpp
+++ b/backends/fs/android/android-saf-fs.cpp
@@ -742,6 +742,7 @@ void AndroidSAFFilesystemNode::cacheData(JNIEnv *env, jobject node) {
if (!_safParent) {
jstring nameObj = (jstring)env->GetObjectField(_safTree, _FID__treeName);
+ debug("_FID__treeName: %p", nameObj);
const char *nameP = env->GetStringUTFChars(nameObj, 0);
if (nameP != 0) {
_newName = Common::String(nameP);
@@ -753,6 +754,7 @@ void AndroidSAFFilesystemNode::cacheData(JNIEnv *env, jobject node) {
Common::String workingPath;
jstring pathObj = (jstring)env->GetObjectField(node, _FID__path);
+ debug("_FID__path: %p", pathObj);
const char *path = env->GetStringUTFChars(pathObj, 0);
if (path == nullptr) {
env->DeleteLocalRef(pathObj);
diff --git a/backends/platform/android/org/scummvm/scummvm/SAFFSTree.java b/backends/platform/android/org/scummvm/scummvm/SAFFSTree.java
index 24c2f2fa796..de2f4233279 100644
--- a/backends/platform/android/org/scummvm/scummvm/SAFFSTree.java
+++ b/backends/platform/android/org/scummvm/scummvm/SAFFSTree.java
@@ -311,6 +311,11 @@ public class SAFFSTree {
_root = new SAFFSNode().reset(null, "", DocumentsContract.getTreeDocumentId(treeUri), 0);
// Update flags and get name
_treeName = stat(_root);
+ if (_treeName == null) {
+ // The tree likely got deleted
+ // Use the document ID instead as this will let the user do some cleanup
+ _treeName = DocumentsContract.getTreeDocumentId(treeUri);
+ }
}
public String getTreeId() {
@@ -752,7 +757,8 @@ public class SAFFSTree {
long endIO = System.currentTimeMillis();
reportIO(startIO, endIO);
}
- // We should never end up here...
+ // We should never end up here
+ // If we do, a tree or a file got likely removed
return null;
}
}
More information about the Scummvm-git-logs
mailing list