Explorar o código

Add workaround for mod install crash

Ivan Savenko hai 2 meses
pai
achega
f1190791a2
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      launcher/modManager/cmodlistview_moc.cpp

+ 8 - 0
launcher/modManager/cmodlistview_moc.cpp

@@ -915,6 +915,8 @@ void CModListView::installFiles(QStringList files)
 
 		if(realFilename.endsWith(".zip", Qt::CaseInsensitive))
 		{
+			try {
+			// TODO: there is some weird crash on Android where this constructor fails to open file
 			ZipArchive archive(qstringToPath(realFilename));
 			auto fileList = archive.listFiles();
 
@@ -940,6 +942,12 @@ void CModListView::installFiles(QStringList files)
 				maps.push_back(filename);
 			else
 				mods.push_back(filename);
+			}
+			catch (const std::runtime_error & e)
+			{
+				QMessageBox::warning(this, tr("Import failed"), tr("Failed to install file %1.\nReason: %2.\nPlease report this issue to developers").arg(filename).arg(QString::fromStdString(e.what())));
+			}
+
 		}
 		else if(realFilename.endsWith(".h3m", Qt::CaseInsensitive) || realFilename.endsWith(".h3c", Qt::CaseInsensitive) || realFilename.endsWith(".vmap", Qt::CaseInsensitive) || realFilename.endsWith(".vcmp", Qt::CaseInsensitive))
 			maps.push_back(filename);