From f34594b73c08853efccfa66d908f0b040bef1ddd Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Wed, 20 Feb 2019 23:34:08 +0300 Subject: [PATCH] Fix stacktrace test for opt builds. --- .../runtime/exceptions/check_stacktrace_format.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 +}