79418786

Date: 2025-02-06 17:18:35
Score: 1
Natty:
Report link

answer by u/tetrahedral on Reddit:

My hunch is that you are passing the text back as a MutableList somewhere and calling .clear() on it without realizing that it’s a reference to the storage. Modify getText and addText to copy into a new array and see if the problem goes away.

I was creating an alias to the mutableList when I was passing it as a parameter. when I called .clear() on it, the list was deleted in both files.

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Alexander Mailyants