0

I wonder if i call

println("my line: ${Throwable().stackTrace[0]}")

will possibly throw IndexOutOfBoundException caused by the empty element of stackTrace?

i don't know what inside of kotlin when we call Throwable().stackTrace

i actually could create a method helper to prevent the exception ( or simply call stackTrace.firstOrNull() ), but i just curious about how kotlin do it

i've read this post in c#, but is it relate to my question? thanks..

nashihu
  • 750
  • 7
  • 17

0 Answers0