Try to avoid exception in getOffset() call

This commit is contained in:
Nikolay Krasko
2017-01-17 21:23:29 +03:00
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) {