summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp')
-rw-r--r--src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp b/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp
index fcc08ea00d..ca16efe34f 100644
--- a/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp
+++ b/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp
@@ -110,6 +110,8 @@ public:
static AssetItem::Type fileType(const QString &filePath)
{
+ if (filePath.isEmpty())
+ return AssetItem::Type::Folder;
const QStringList paths = filePath.split(QLatin1Char('/'));
QString fullPath;
AssetItem::Type res = AssetItem::Type::Invalid;
@@ -146,7 +148,7 @@ public:
jobjectArray jFiles = static_cast<jobjectArray>(files.object());
const jint nFiles = env->GetArrayLength(jFiles);
for (int i = 0; i < nFiles; ++i) {
- AssetItem item{QJNIObjectPrivate(env->GetObjectArrayElement(jFiles, i)).toString()};
+ AssetItem item{QJNIObjectPrivate::fromLocalRef(env->GetObjectArrayElement(jFiles, i)).toString()};
insert(std::upper_bound(begin(), end(), item, [](const auto &a, const auto &b){
return a.name < b.name;
}), item);
@@ -399,7 +401,8 @@ public:
private:
AAsset *m_assetFile = nullptr;
AAssetManager *m_assetManager = nullptr;
- QString m_fileName;
+ // initialize with a name that can't be used as a file name
+ QString m_fileName = QLatin1String(".");
bool m_isFolder = false;
};