Skip to content

Commit

Permalink
Handle non-existing list
Browse files Browse the repository at this point in the history
  • Loading branch information
KuechA committed Feb 9, 2024
1 parent 819f3ef commit 3e4029f
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class DFGFunctionSummaries {
}

private fun findFunctionDeclarationEntry(functionDecl: FunctionDeclaration): List<DFGEntry>? {
if (functionToDFGEntryMap.isEmpty()) return null

val language = functionDecl.language
val languageName = language?.javaClass?.name
val methodName = functionDecl.name
Expand All @@ -82,7 +84,7 @@ class DFGFunctionSummaries {
} else if (matchingEntries.filter { it.signature != null }.size == 1) {
// Only one entry with a matching signature => We take this one.
functionToDFGEntryMap[matchingEntries.single { it.signature != null }]
} else {
} else if (matchingEntries.isNotEmpty()) {
/* There are multiple matching entries. We use the following routine:
* First, we filter for existing signatures.
* Second, we filter for the most precise class.
Expand Down Expand Up @@ -116,6 +118,8 @@ class DFGFunctionSummaries {
mostPreciseClassEntries.sortByDescending { it.signature?.size ?: 0 }
}
functionToDFGEntryMap[matchingEntries.first()]
} else {
null
}
}

Expand Down

0 comments on commit 3e4029f

Please sign in to comment.