Try to avoid exception in getOffset() call
This commit is contained in:
committed by
Dmitry Jemerov
parent
eb8415a1f3
commit
615f9d3a1f
@@ -412,6 +412,7 @@ fun ImportableFqNameClassifier.isImportableDescriptorImported(descriptor: Declar
|
||||
|
||||
fun OffsetMap.tryGetOffset(key: OffsetKey): Int? {
|
||||
try {
|
||||
if (!containsOffset(key)) return null
|
||||
return getOffset(key).takeIf { it != -1 } // prior to IDEA 2016.3 getOffset() returned -1 if not found, now it throws exception
|
||||
}
|
||||
catch(e: Exception) {
|
||||
|
||||
Reference in New Issue
Block a user