title: Android studio: FATAL EXCEPTION: DefaultDispatcher-worker-2
body: <p>Im running android studio 4.1.2
  im trying to run this transaction:</p>
  <p>QuestionDao.kt</p>
  <pre><code>  @Transaction
      suspend fun getRandomRN(num: Int):List&lt;Question&gt;{
       val result = getRandomWrongOrNotAnsweredQuestionsByCount(num)
          val last = getLastQuizNumber()
  
          val newResult = mutableListOf&lt;Question&gt;()
  
          result?.forEachIndexed{ index,element -&gt;
              element.status=0
              element.quiz_number = last+1
              newResult[index] = element  // this is line 91
          }
  
          result?.let { updateQuestions(newResult) }
          return newResult
      }
  </code></pre>
  <p>running app throw error:</p>
  <pre><code>com.example.android.myapplication E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-2
      Process: com.example.android.myapplication, PID: 25245
      java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
          at java.util.ArrayList.set(ArrayList.java:453)
          at com.example.android.webpooyeshelevatorquize.data.QuestionDao$DefaultImpls.getRandomRN(QuestionDao.kt:91)
  </code></pre>
  <p><code>QuestionDao.kt:91</code> is <code>newResult[index] = element</code>.<br />
  BTW the context is <code>Dispachers.IO</code></p>