diff --git a/backend.native/tests/runtime/exceptions/check_stacktrace_format.kt b/backend.native/tests/runtime/exceptions/check_stacktrace_format.kt index 32fd5e03fde..8fde9f81158 100644 --- a/backend.native/tests/runtime/exceptions/check_stacktrace_format.kt +++ b/backend.native/tests/runtime/exceptions/check_stacktrace_format.kt @@ -33,9 +33,11 @@ fun main(args : Array) { try { functionB() } catch (e: Throwable) { - val st = e.getStackTrace() - repeat(3) { - checkStringFormat(st[it]) + val stacktrace = e.getStackTrace() + if (stacktrace.size >= 3) { + repeat(3) { + checkStringFormat(stacktrace[it]) + } } } -} \ No newline at end of file +}