@@ -101,17 +101,16 @@ std::vector<QString> getExternalFilesDirs(jstring* type)
101101 type);
102102
103103 QAndroidJniEnvironment jni;
104- jni->ExceptionClear ();
105-
106104 const auto length = jni->GetArrayLength (external_files_dirs.object <jarray>());
105+
107106 std::vector<QString> locations;
108107 locations.reserve (std::size_t (length));
109108 for (auto i = 0 ; i < length; ++i)
110109 {
111110 auto location_jni = jni->GetObjectArrayElement (external_files_dirs.object <jobjectArray>(), i);
112111 auto location = QAndroidJniObject{ location_jni }.toString ();
113112
114- const auto warning_path = location + QLatin1String (" /README.html" );
113+ const auto warning_path = QString ( location + QLatin1String (" /README.html" ) );
115114 QFile warning (warning_path);
116115 if (warning.open (QIODevice::WriteOnly | QIODevice::Truncate))
117116 {
@@ -218,9 +217,9 @@ std::shared_ptr<const std::vector<StorageLocation>> buildLocationCache()
218217 }
219218
220219 auto locations = std::make_shared<std::vector<StorageLocation>>();
221- locations->reserve (1 + locations_normal.size ()
222- + locations_application.size ()
223- + locations_readonly.size ());
220+ locations->reserve (locations_normal.size ()
221+ + locations_application.size ()
222+ + locations_readonly.size ());
224223 for (const auto & path : locations_normal)
225224 locations->emplace_back (path, StorageLocation::HintNormal);
226225 for (const auto & path : locations_application)
@@ -247,6 +246,7 @@ std::shared_ptr<const std::vector<StorageLocation>> StorageLocation::knownLocati
247246 locations = Android::buildLocationCache ();
248247 Android::locations_cache = locations;
249248 }
249+ Q_ASSERT (locations);
250250 return locations;
251251#else
252252 auto locations = std::make_shared<std::vector<StorageLocation>>();
0 commit comments