mirror of
https://github.com/github/codeql.git
synced 2025-12-17 09:13:20 +01:00
Kotlin: Avoid using a possibly-throwing method
This commit is contained in:
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.util.getChildren
|
|||||||
class CommentExtractorLighterAST(fileExtractor: KotlinFileExtractor, file: IrFile, fileLabel: Label<out DbFile>): CommentExtractor(fileExtractor, file, fileLabel) {
|
class CommentExtractorLighterAST(fileExtractor: KotlinFileExtractor, file: IrFile, fileLabel: Label<out DbFile>): CommentExtractor(fileExtractor, file, fileLabel) {
|
||||||
// Returns true if it extracted the comments; false otherwise.
|
// Returns true if it extracted the comments; false otherwise.
|
||||||
fun extract(): Boolean {
|
fun extract(): Boolean {
|
||||||
val sourceElement = (file.metadata as? FirMetadataSource.File)?.files?.get(0)?.source
|
val sourceElement = (file.metadata as? FirMetadataSource.File)?.files?.elementAtOrNull(0)?.source
|
||||||
val treeStructure = sourceElement?.treeStructure
|
val treeStructure = sourceElement?.treeStructure
|
||||||
if (treeStructure == null) {
|
if (treeStructure == null) {
|
||||||
return false
|
return false
|
||||||
|
|||||||
Reference in New Issue
Block a user