mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fix possible division by zero exception.
This commit is contained in:
@@ -29,6 +29,9 @@ class ExternalAnnotationsDataService: AbstractProjectDataService<LibraryData, Li
|
||||
if (!Registry.`is`("external.system.import.resolve.annotations")) {
|
||||
return
|
||||
}
|
||||
if (imported.isEmpty()) {
|
||||
return
|
||||
}
|
||||
|
||||
projectData?.apply {
|
||||
val importRepositories =
|
||||
@@ -44,7 +47,7 @@ class ExternalAnnotationsDataService: AbstractProjectDataService<LibraryData, Li
|
||||
}
|
||||
|
||||
val resolver = ExternalAnnotationsArtifactsResolver.EP_NAME.extensionList.firstOrNull() ?: return
|
||||
val totalSize = imported.size.toDouble()
|
||||
val totalSize = imported.size
|
||||
|
||||
runBackgroundableTask("Resolving external annotations", project) { indicator ->
|
||||
indicator.isIndeterminate = false
|
||||
@@ -52,7 +55,6 @@ class ExternalAnnotationsDataService: AbstractProjectDataService<LibraryData, Li
|
||||
if (indicator.isCanceled) {
|
||||
return@runBackgroundableTask
|
||||
}
|
||||
indicator.fraction = (index.toDouble() + 1) / totalSize
|
||||
val libraryData = dataNode.data
|
||||
val libraryName = libraryData.internalName
|
||||
val library = modelsProvider.getLibraryByName(libraryName)
|
||||
@@ -61,6 +63,7 @@ class ExternalAnnotationsDataService: AbstractProjectDataService<LibraryData, Li
|
||||
val mavenId = "${libraryData.groupId}:${libraryData.artifactId}:${libraryData.version}"
|
||||
resolver.resolve(project, library, mavenId)
|
||||
}
|
||||
indicator.fraction = (index + 1) / totalSize.toDouble()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user